1 | import {
|
2 | setupApplicationTest as upstreamSetupApplicationTest,
|
3 | setupRenderingTest as upstreamSetupRenderingTest,
|
4 | setupTest as upstreamSetupTest,
|
5 | type SetupTestOptions,
|
6 | } from 'ember-qunit';
|
7 |
|
8 | // This file exists to provide wrappers around ember-qunit's
|
9 | // test setup functions. This way, you can easily extend the setup that is
|
10 | // needed per test type.
|
11 |
|
12 | function setupApplicationTest(hooks: NestedHooks, options?: SetupTestOptions) {
|
13 | upstreamSetupApplicationTest(hooks, options);
|
14 |
|
15 | // Additional setup for application tests can be done here.
|
16 | //
|
17 | // For example, if you need an authenticated session for each
|
18 | // application test, you could do:
|
19 | //
|
20 | // hooks.beforeEach(async function () {
|
21 | // await authenticateSession(); // ember-simple-auth
|
22 | // });
|
23 | //
|
24 | // This is also a good place to call test setup functions coming
|
25 | // from other addons:
|
26 | //
|
27 | // setupIntl(hooks, 'en-us'); // ember-intl
|
28 | // setupMirage(hooks); // ember-cli-mirage
|
29 | }
|
30 |
|
31 | function setupRenderingTest(hooks: NestedHooks, options?: SetupTestOptions) {
|
32 | upstreamSetupRenderingTest(hooks, options);
|
33 |
|
34 | // Additional setup for rendering tests can be done here.
|
35 | }
|
36 |
|
37 | function setupTest(hooks: NestedHooks, options?: SetupTestOptions) {
|
38 | upstreamSetupTest(hooks, options);
|
39 |
|
40 | // Additional setup for unit tests can be done here.
|
41 | }
|
42 |
|
43 | export { setupApplicationTest, setupRenderingTest, setupTest };
|