Skip to content

Commit

Permalink
ember-qunit: make SetupTestOptions public
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskrycho committed Sep 1, 2022
1 parent 7143245 commit 5a8a765
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
23 changes: 22 additions & 1 deletion types/ember-qunit/ember-qunit-tests.ts
Expand Up @@ -9,6 +9,8 @@ import {
setResolver,
setupRenderingTest,
setupTest,
SetupTestOptions,
setupApplicationTest,
} from 'ember-qunit';
import { render, TestContext } from '@ember/test-helpers';
import EmberResolver from 'ember-resolver';
Expand Down Expand Up @@ -65,7 +67,7 @@ module('rendering', function (hooks) {
});

module('misc and async', function (hooks) {
hooks.beforeEach(async function(assert) {
hooks.beforeEach(async function (assert) {
assert.ok(true, 'hooks can be async');
});

Expand Down Expand Up @@ -294,3 +296,22 @@ module('extending TestContext works', function () {
});

start();

module('with setup options', function (hooks) {
// $ExpectType SetupTestOptions | undefined
type SetupTestOptions = Parameters<typeof setupTest>[1];
// $ExpectType SetupTestOptions | undefined
type SetupRenderingTestOptions = Parameters<typeof setupRenderingTest>[1];
// $ExpectType SetupTestOptions | undefined
type SetupApplicationTestOptions = Parameters<typeof setupApplicationTest>[1];

const resolver = EmberResolver.create();

setupTest(hooks, {});
setupRenderingTest(hooks, {});
setupApplicationTest(hooks, {});

setupTest(hooks, { resolver });
setupRenderingTest(hooks, { resolver });
setupApplicationTest(hooks, { resolver });
});
2 changes: 1 addition & 1 deletion types/ember-qunit/index.d.ts
Expand Up @@ -15,7 +15,7 @@ import { TestContext } from '@ember/test-helpers';
*/
export function setResolver(resolver: EmberResolver): void;

interface SetupTestOptions {
export interface SetupTestOptions {
/**
* The resolver to use when instantiating container-managed entities in the test.
*/
Expand Down
2 changes: 1 addition & 1 deletion types/ember__object/evented.d.ts
@@ -1,5 +1,5 @@
import Mixin from '@ember/object/mixin';
import { AnyFn, EmberMethod, MethodNamesOf, MethodParams, MethodsOf } from 'ember/-private/type-utils';
import { AnyFn, EmberMethod } from 'ember/-private/type-utils';

/**
* This mixin allows for Ember objects to subscribe to and emit events.
Expand Down

0 comments on commit 5a8a765

Please sign in to comment.