@@ -2,12 +2,22 @@ import { getContext, settled } from '@ember/test-helpers';
22import { animationsSettled } from 'ember-animated/test-support' ;
33import { waitForSource } from 'ember-orbit/test-support' ;
44
5+ import type Owner from '@ember/owner' ;
6+
7+ import type Coordinator from '@orbit/coordinator' ;
8+ import type { IndexedDBSource } from '@orbit/indexeddb' ;
9+ import type BucketClass from '@orbit/indexeddb-bucket' ;
10+
11+ // @ts -expect-error TODO: not yet typed
512import seedOrbit from './orbit/seed' ;
613
714export async function waitForAll ( ) {
8- const { owner } = getContext ( ) ;
15+ const { owner } = getContext ( ) as { owner : Owner } ;
16+ // @ts -expect-error Not sure why it says this does not exist
917 const { services } = owner . resolveRegistration ( 'ember-orbit:config' ) ;
10- const coordinator = owner . lookup ( `service:${ services . coordinator } ` ) ;
18+ const coordinator = owner . lookup (
19+ `service:${ services . coordinator } ` ,
20+ ) as unknown as Coordinator ;
1121
1222 for ( let source of coordinator . sources ) {
1323 await waitForSource ( source ) ;
@@ -17,7 +27,10 @@ export async function waitForAll() {
1727 await animationsSettled ( ) ;
1828}
1929
20- export function resetStorage ( hooks , options = { } ) {
30+ export function resetStorage (
31+ hooks : NestedHooks ,
32+ options : { seed ?: { source ?: string ; scenario ?: string } } = { } ,
33+ ) {
2134 hooks . beforeEach ( async function ( ) {
2235 if ( options . seed ) {
2336 const sourceName = options . seed . source ?? 'backup' ;
@@ -28,11 +41,15 @@ export function resetStorage(hooks, options = {}) {
2841 } ) ;
2942
3043 hooks . afterEach ( async function ( ) {
31- const backup = this . owner . lookup ( 'data-source:backup' ) ;
44+ const backup = this . owner . lookup (
45+ 'data-source:backup' ,
46+ ) as unknown as IndexedDBSource ;
3247
3348 await backup . cache . deleteDB ( ) ;
3449
35- const bucket = this . owner . lookup ( 'data-bucket:main' ) ;
50+ const bucket = this . owner . lookup ( 'data-bucket:main' ) as unknown as
51+ | BucketClass
52+ | undefined ;
3653
3754 await bucket ?. clear ( ) ;
3855
0 commit comments