@@ -16,9 +16,7 @@ import { DiscriminatorTypeComposer } from '../discriminators';
1616beforeAll ( ( ) => MovieModel . base . connect ( ) ) ;
1717afterAll ( ( ) => MovieModel . base . disconnect ( ) ) ;
1818
19- export const allowedDKeys = [ 'type' , 'kind' , 'error' ] ;
20-
21- const { CharacterModel, PersonModel, DroidModel } = getCharacterModels ( allowedDKeys [ 0 ] ) ;
19+ const { CharacterModel, PersonModel, DroidModel } = getCharacterModels ( 'type' ) ;
2220
2321describe ( 'composeWithMongooseDiscriminators ->' , ( ) => {
2422 beforeEach ( ( ) => {
@@ -50,14 +48,14 @@ describe('composeWithMongooseDiscriminators ->', () => {
5048 customizationOptions : {
5149 inputType : {
5250 fields : {
53- required : [ allowedDKeys [ 1 ] ] ,
51+ required : [ 'kind' ] ,
5452 } ,
5553 } ,
5654 } ,
5755 } ) ;
5856 const filterArgInFindOne : any = typeComposer . getResolver ( 'findOne' ) . getArg ( 'filter' ) ;
5957 const inputComposer = new InputTypeComposer ( filterArgInFindOne . type ) ;
60- expect ( inputComposer . isRequired ( allowedDKeys [ 1 ] ) ) . toBe ( true ) ;
58+ expect ( inputComposer . isRequired ( 'kind' ) ) . toBe ( true ) ;
6159 } ) ;
6260
6361 it ( 'should proceed customizationOptions.inputType.fields.required' , ( ) => {
@@ -90,7 +88,7 @@ describe('composeWithMongooseDiscriminators ->', () => {
9088 expect ( baseDTC . getFieldNames ( ) ) . toEqual ( Object . keys ( baseDTC . getDInterface ( ) . getFields ( ) ) ) ;
9189
9290 beforeAll ( ( ) =>
93- baseDTC . addDFields ( {
91+ baseDTC . addFields ( {
9492 field1 : 'String' ,
9593 field2 : 'String' ,
9694 } ) ) ;
@@ -177,7 +175,7 @@ describe('composeWithMongooseDiscriminators ->', () => {
177175 const characterDTC = composeWithMongooseDiscriminators ( CharacterModel ) ;
178176 const personTC = characterDTC . discriminator ( PersonModel ) ;
179177 const droidTC = characterDTC . discriminator ( DroidModel ) ;
180- const fieldName = allowedDKeys [ 1 ] ;
178+ const fieldName = 'kind' ;
181179 const fieldExtension = {
182180 type : 'String' ,
183181 description : 'Hello I am changed' ,
@@ -190,7 +188,9 @@ describe('composeWithMongooseDiscriminators ->', () => {
190188 it ( 'should extend field on baseTC' , ( ) => {
191189 expect ( characterDTC . getFieldType ( fieldName ) . toString ( ) ) . toEqual ( graphql . GraphQLString . name ) ;
192190
193- expect ( characterDTC . getField ( fieldName ) . description ) . toEqual ( fieldExtension . description ) ;
191+ expect ( ( characterDTC . getField ( fieldName ) : any ) . description ) . toEqual (
192+ fieldExtension . description
193+ ) ;
194194 } ) ;
195195
196196 it ( 'should extend field type on DInterface' , ( ) => {
@@ -206,11 +206,11 @@ describe('composeWithMongooseDiscriminators ->', () => {
206206 it ( 'should extend field on childTC' , ( ) => {
207207 expect ( personTC . getFieldType ( fieldName ) . toString ( ) ) . toEqual ( graphql . GraphQLString . name ) ;
208208
209- expect ( personTC . getField ( fieldName ) . description ) . toEqual ( fieldExtension . description ) ;
209+ expect ( ( personTC . getField ( fieldName ) : any ) . description ) . toEqual ( fieldExtension . description ) ;
210210
211211 expect ( droidTC . getFieldType ( fieldName ) . toString ( ) ) . toEqual ( graphql . GraphQLString . name ) ;
212212
213- expect ( droidTC . getField ( fieldName ) . description ) . toEqual ( fieldExtension . description ) ;
213+ expect ( ( droidTC . getField ( fieldName ) : any ) . description ) . toEqual ( fieldExtension . description ) ;
214214 } ) ;
215215 } ) ;
216216
0 commit comments