@@ -4,17 +4,19 @@ import test from 'ava';
44import createLoaderTypePropertyDeclaration from '../../../src/utilities/createLoaderTypePropertyDeclaration' ;
55
66test ( 'generates loader type property declaration' , ( t ) => {
7- t . true ( createLoaderTypePropertyDeclaration ( 'FooLoader' , 'text' , 'foo' , false ) === '+FooLoader: DataLoader<string, FooRecordType>' ) ;
8- t . true ( createLoaderTypePropertyDeclaration ( 'FooLoader' , 'integer' , 'foo' , false ) === '+FooLoader: DataLoader<number, FooRecordType>' ) ;
7+ t . is ( createLoaderTypePropertyDeclaration ( 'FooLoader' , 'text' , 'foo' , false ) , '+FooLoader: DataLoader<string, FooRecordType>' ) ;
8+ t . is ( createLoaderTypePropertyDeclaration ( 'FooLoader' , 'integer' , 'foo' , false ) , '+FooLoader: DataLoader<number, FooRecordType>' ) ;
99} ) ;
1010
1111test ( 'generates loader type property declaration (array)' , ( t ) => {
12- t . true ( createLoaderTypePropertyDeclaration ( 'FooLoader' , 'text' , 'foo' , true ) === '+FooLoader: DataLoader<string, $ReadOnlyArray<FooRecordType>>' ) ;
13- t . true ( createLoaderTypePropertyDeclaration ( 'FooLoader' , 'integer' , 'foo' , true ) === '+FooLoader: DataLoader<number, $ReadOnlyArray<FooRecordType>>' ) ;
12+ t . is ( createLoaderTypePropertyDeclaration ( 'FooLoader' , 'text' , 'foo' , true ) , '+FooLoader: DataLoader<string, $ReadOnlyArray<FooRecordType>>' ) ;
13+ t . is ( createLoaderTypePropertyDeclaration ( 'FooLoader' , 'integer' , 'foo' , true ) , '+FooLoader: DataLoader<number, $ReadOnlyArray<FooRecordType>>' ) ;
1414} ) ;
1515
1616test ( 'throws an error if data type cannot resolve to a string or number' , ( t ) => {
1717 t . throws ( ( ) : void => {
1818 createLoaderTypePropertyDeclaration ( 'FooLoader' , 'unknown' , 'foo' , false ) ;
19- } , 'Cannot resolve key type.' ) ;
19+ } , {
20+ message : 'Cannot resolve key type.' ,
21+ } ) ;
2022} ) ;
0 commit comments