From 3b32c74bb3b3c0d465e1f45b74c593ac6da428a4 Mon Sep 17 00:00:00 2001 From: Enubia Date: Mon, 7 Jun 2021 23:30:22 +0200 Subject: [PATCH] fixed types in all tests this pr should fix all types in every testcase that was previously throwing a compile error due to type miss matching local test passed but i wasn't able to test the integration tests so please run them through GH actions to see if everything still works properly --- src/engine/action/Action.spec.ts | 16 +++--- src/engine/entity/Entity.spec.ts | 2 +- src/engine/entity/ViewEntity.spec.ts | 3 +- src/engine/filter.spec.ts | 5 +- src/engine/index/Index.spec.ts | 6 +-- src/engine/permission/Permission.spec.ts | 56 ++++++++++---------- src/engine/protocol/ProtocolType.spec.ts | 9 ++-- src/engine/schema/Schema.spec.ts | 8 +-- src/engine/storage/StorageType.spec.ts | 5 +- src/engine/subscription/Subscription.spec.ts | 22 ++++---- src/engine/util.spec.ts | 28 +++++----- src/graphqlProtocol/filter.spec.ts | 7 ++- test/mutation.spec.ts | 9 ++-- test/storageDataTypes.spec.ts | 3 +- 14 files changed, 93 insertions(+), 86 deletions(-) diff --git a/src/engine/action/Action.spec.ts b/src/engine/action/Action.spec.ts index 207bf8e6..946bdc82 100644 --- a/src/engine/action/Action.spec.ts +++ b/src/engine/action/Action.spec.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-empty-function */ /* eslint-disable @typescript-eslint/explicit-function-return-type */ -import { Action, isAction, ACTION_TYPE_QUERY } from './Action'; +import { Action, isAction, ACTION_TYPE_QUERY, ActionPreProcessor, ActionPostProcessor } from './Action'; import { Permission, isPermission } from '../permission/Permission'; import { DataTypeString, DataTypeInteger } from '../datatype/dataTypes'; @@ -9,7 +9,7 @@ import { buildObjectDataType } from '../datatype/ObjectDataType'; import { passOrThrow } from '../util'; import { generateTestSchema } from '../../graphqlProtocol/test-helper'; -import { generateGraphQLSchema } from '../../graphqlProtocol/generator'; +import { generateGraphQLSchema } from '../../graphqlProtocol'; import { graphql } from 'graphql'; describe('Action', () => { @@ -27,6 +27,7 @@ describe('Action', () => { // eslint-disable-next-line no-new new Action({ name: 'example', + resolve: () => {} }); } @@ -54,6 +55,7 @@ describe('Action', () => { description: 'do something', input: 123, output: 456, + resolve() {} }); } @@ -81,6 +83,7 @@ describe('Action', () => { name: 'example', description: 'do something', input() {}, + resolve() {}, output: 'wrong', }); } @@ -175,6 +178,7 @@ describe('Action', () => { new Action({ name: 'example', description: 'do something', + resolve: undefined as () => any }); } @@ -350,7 +354,7 @@ describe('Action', () => { name: 'example', description: 'do something', resolve() {}, - preProcessor: 'not-a-func', + preProcessor: ('not-a-func' as unknown) as ActionPreProcessor, }); } @@ -427,7 +431,7 @@ describe('Action', () => { name: 'example', description: 'do something', resolve() {}, - postProcessor: 'not-a-func', + postProcessor: ('not-a-func' as unknown) as ActionPostProcessor, }); } @@ -460,8 +464,8 @@ describe('Action', () => { }; }, postProcessor: ({ result, input }) => { - if (input > 1000) { - result.value *= 2; + if ((input as any) > 1000) { + (result as any).value *= 2; } }, }), diff --git a/src/engine/entity/Entity.spec.ts b/src/engine/entity/Entity.spec.ts index 5fa53370..fb77f1f4 100644 --- a/src/engine/entity/Entity.spec.ts +++ b/src/engine/entity/Entity.spec.ts @@ -17,7 +17,7 @@ import { Permission, isPermission } from '../permission/Permission'; import { passOrThrow } from '../util'; import { DataTypeID, DataTypeString } from '../datatype/dataTypes'; -import { generateGraphQLSchema } from '../../graphqlProtocol/generator'; +import { generateGraphQLSchema } from '../../graphqlProtocol'; import { generateTestSchema } from '../../graphqlProtocol/test-helper'; describe('Entity', () => { diff --git a/src/engine/entity/ViewEntity.spec.ts b/src/engine/entity/ViewEntity.spec.ts index e385c816..cba0ea21 100644 --- a/src/engine/entity/ViewEntity.spec.ts +++ b/src/engine/entity/ViewEntity.spec.ts @@ -3,6 +3,7 @@ import { ViewEntity, isViewEntity } from './ViewEntity'; import { Permission, isPermission } from '../permission/Permission'; import { passOrThrow } from '../util'; import { DataTypeID, DataTypeString } from '../datatype/dataTypes'; +import { StorageType } from '../storage/StorageType'; describe('ViewEntity', () => { it('should have a name', () => { @@ -159,7 +160,7 @@ describe('ViewEntity', () => { description: 'ID of item', }, }, - storageType: {}, + storageType: {} as StorageType, }); } diff --git a/src/engine/filter.spec.ts b/src/engine/filter.spec.ts index 63384c76..9cdab50b 100644 --- a/src/engine/filter.spec.ts +++ b/src/engine/filter.spec.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/camelcase */ /* eslint-disable @typescript-eslint/no-empty-function */ /* eslint-disable @typescript-eslint/explicit-function-return-type */ @@ -165,11 +164,11 @@ describe('filter', () => { it('should throw if provided params are invalid', () => { function fn1() { - validateFilterLevel(); + validateFilterLevel(undefined, undefined, undefined, undefined); } function fn2() { - validateFilterLevel([], null, []); + validateFilterLevel([], null, [], undefined); } function fn3() { diff --git a/src/engine/index/Index.spec.ts b/src/engine/index/Index.spec.ts index 53d52793..288b4efd 100644 --- a/src/engine/index/Index.spec.ts +++ b/src/engine/index/Index.spec.ts @@ -63,7 +63,7 @@ describe('Index', () => { // eslint-disable-next-line no-new new Index({ type: INDEX_UNIQUE, - attributes: [123], + attributes: [((123 as unknown) as string)], }); } @@ -146,7 +146,7 @@ describe('Index', () => { }; function fn() { - processEntityIndexes(entity, indexes); + processEntityIndexes(entity, (indexes as unknown) as Index[]); } expect(fn).toThrowErrorMatchingSnapshot(); @@ -156,7 +156,7 @@ describe('Index', () => { const indexes = [{ foo: 'bar' }]; function fn() { - processEntityIndexes(entity, indexes); + processEntityIndexes(entity, (indexes as unknown) as Index[]); } expect(fn).toThrowErrorMatchingSnapshot(); diff --git a/src/engine/permission/Permission.spec.ts b/src/engine/permission/Permission.spec.ts index d7bbcfa0..a6ad0e3c 100644 --- a/src/engine/permission/Permission.spec.ts +++ b/src/engine/permission/Permission.spec.ts @@ -16,7 +16,7 @@ import { buildPermissionFilter, buildLookupsPermissionFilter, processEntityPermissions, - processActionPermissions, + processActionPermissions, PermissionMap, } from './Permission'; import { Entity } from '../entity/Entity'; import { Action } from '../action/Action'; @@ -100,7 +100,7 @@ describe('Permission', () => { describe('role permissions', () => { it('should reject if role name is missing', () => { function fn1() { - new Permission().role(); + new Permission().role((undefined as unknown) as string); } expect(fn1).toThrowErrorMatchingSnapshot(); @@ -118,7 +118,7 @@ describe('Permission', () => { describe('userAttribute permissions', () => { it('should reject if attribute name is missing', () => { function fn1() { - new Permission().userAttribute(); + new Permission().userAttribute((undefined as unknown) as string); } expect(fn1).toThrowErrorMatchingSnapshot(); @@ -136,7 +136,7 @@ describe('Permission', () => { describe('lookup permissions', () => { it('should reject if entity is missing', () => { function fn1() { - new Permission().lookup(); + new Permission().lookup((undefined as unknown) as Entity, undefined); } expect(fn1).toThrowErrorMatchingSnapshot(); @@ -144,7 +144,7 @@ describe('Permission', () => { it('should reject if lookupMap is missing', () => { function fn1() { - new Permission().lookup(Language); + new Permission().lookup(Language, undefined); } expect(fn1).toThrowErrorMatchingSnapshot(); @@ -154,7 +154,7 @@ describe('Permission', () => { describe('value permissions', () => { it('should reject if attribute name is missing', () => { function fn1() { - new Permission().value(); + new Permission().value((undefined as unknown) as string, undefined); } expect(fn1).toThrowErrorMatchingSnapshot(); @@ -162,7 +162,7 @@ describe('Permission', () => { it('should reject if value is missing', () => { function fn1() { - new Permission().value('someAttribute'); + new Permission().value('someAttribute', undefined); } expect(fn1).toThrowErrorMatchingSnapshot(); @@ -218,17 +218,17 @@ describe('Permission', () => { function fn() { passOrThrow( - isPermissionsArray() || + isPermissionsArray(undefined) || isPermissionsArray(null) || isPermissionsArray([]) || - isPermissionsArray({}) || - isPermissionsArray(function test() {}) || - isPermissionsArray(Error) || - isPermissionsArray([{}]) || - isPermissionsArray([function test() {}]) || - isPermissionsArray([Error]) || + isPermissionsArray(({} as unknown) as Permission) || + isPermissionsArray((function test() {} as unknown) as Permission[]) || + isPermissionsArray((Error as unknown) as Permission[]) || + isPermissionsArray(([{}] as unknown) as Permission[]) || + isPermissionsArray(([function test() {}] as unknown) as Permission[]) || + isPermissionsArray(([Error] as unknown) as Permission[]) || isPermissionsArray([permission, null]) || - isPermissionsArray([permission, {}, permission]), + isPermissionsArray([permission, {} as Permission, permission]), () => 'Not a Permissions array', ); } @@ -363,7 +363,7 @@ describe('Permission', () => { describe('permissions description', () => { it('should reject if non-Permission object is provided', () => { function fn() { - generatePermissionDescription({ foo: 'bar' }); + generatePermissionDescription(({ foo: 'bar' } as unknown) as Permission); } expect(fn).toThrowErrorMatchingSnapshot(); @@ -430,7 +430,7 @@ describe('Permission', () => { it('should reject if non-Permission object is provided', () => { function fn() { - checkPermissionSimple({}); + checkPermissionSimple({} as Permission); } expect(fn).toThrowErrorMatchingSnapshot(); @@ -438,7 +438,7 @@ describe('Permission', () => { it('should reject if user roles are not provided as an array', () => { function fn() { - checkPermissionSimple(new Permission(), null, { bad: 'roles' }); + checkPermissionSimple(new Permission(), null, ({ bad: 'roles' } as unknown) as any[]); } expect(fn).toThrowErrorMatchingSnapshot(); @@ -521,7 +521,7 @@ describe('Permission', () => { function fn() { const permission = new Permission().userAttribute('author'); - buildUserAttributesPermissionFilter({ permission }); + buildUserAttributesPermissionFilter({ permission, userId: undefined }); } expect(fn).toThrowErrorMatchingSnapshot(); @@ -569,7 +569,7 @@ describe('Permission', () => { function fn() { const permission = new Permission().state('completed'); - buildStatesPermissionFilter({ permission }); + buildStatesPermissionFilter({ permission, entity: undefined }); } expect(fn).toThrowErrorMatchingSnapshot(); @@ -913,7 +913,7 @@ describe('Permission', () => { const permissions = ['bad']; function fn() { - processEntityPermissions(entity, permissions); + processEntityPermissions(entity, (permissions as unknown) as PermissionMap); } expect(fn).toThrowErrorMatchingSnapshot(); @@ -925,7 +925,7 @@ describe('Permission', () => { }; function fn() { - processEntityPermissions(entity, permissions); + processEntityPermissions(entity, (permissions as unknown) as PermissionMap); } expect(fn).toThrowErrorMatchingSnapshot(); @@ -937,7 +937,7 @@ describe('Permission', () => { }; function fn() { - processEntityPermissions(entity, permissions); + processEntityPermissions(entity, (permissions as unknown) as PermissionMap); } expect(fn).toThrowErrorMatchingSnapshot(); @@ -949,7 +949,7 @@ describe('Permission', () => { }; function fn1() { - processEntityPermissions(entity, permissions1); + processEntityPermissions(entity, (permissions1 as unknown) as PermissionMap); } expect(fn1).toThrowErrorMatchingSnapshot(); @@ -959,7 +959,7 @@ describe('Permission', () => { }; function fn2() { - processEntityPermissions(entity, permissions2); + processEntityPermissions(entity, (permissions2 as unknown) as PermissionMap); } expect(fn2).toThrowErrorMatchingSnapshot(); @@ -973,7 +973,7 @@ describe('Permission', () => { }; function fn3() { - processEntityPermissions(entity, permissions3); + processEntityPermissions(entity, (permissions3 as unknown) as PermissionMap); } expect(fn3).toThrowErrorMatchingSnapshot(); @@ -1121,7 +1121,7 @@ describe('Permission', () => { const permissions1 = ['bad']; function fn1() { - processActionPermissions(action, permissions1); + processActionPermissions(action, (permissions1 as unknown) as Permission[]); } expect(fn1).toThrowErrorMatchingSnapshot(); @@ -1131,7 +1131,7 @@ describe('Permission', () => { }; function fn2() { - processActionPermissions(action, permissions2); + processActionPermissions(action, (permissions2 as unknown) as Permission[]); } expect(fn2).toThrowErrorMatchingSnapshot(); diff --git a/src/engine/protocol/ProtocolType.spec.ts b/src/engine/protocol/ProtocolType.spec.ts index 74c46b37..030acd5e 100644 --- a/src/engine/protocol/ProtocolType.spec.ts +++ b/src/engine/protocol/ProtocolType.spec.ts @@ -1,12 +1,13 @@ /* eslint-disable @typescript-eslint/explicit-function-return-type */ -import { ProtocolType, isProtocolType } from './ProtocolType'; +import { ProtocolType, isProtocolType, ProtocolDataType } from './ProtocolType'; import { DataTypeID, DataTypeString, DataTypeInteger, DataTypeBoolean, } from '../datatype/dataTypes'; +import { DataType } from '../datatype/DataType'; describe('ProtocolType', () => { const ProtocolTypeREST = new ProtocolType({ @@ -80,15 +81,15 @@ describe('ProtocolType', () => { it('should reject invalid data type mappings', () => { function fn1() { - ProtocolTypeREST.addDataTypeMap('something'); + ProtocolTypeREST.addDataTypeMap(('something' as unknown) as DataType, undefined); } function fn2() { - ProtocolTypeREST.addDataTypeMap(DataTypeID); + ProtocolTypeREST.addDataTypeMap(DataTypeID, undefined); } function fn3() { - ProtocolTypeREST.addDataTypeMap(DataTypeString, {}); + ProtocolTypeREST.addDataTypeMap(DataTypeString, ({} as unknown) as ProtocolDataType); } expect(fn1).toThrowErrorMatchingSnapshot(); diff --git a/src/engine/schema/Schema.spec.ts b/src/engine/schema/Schema.spec.ts index 162f3e0d..8505ec0a 100644 --- a/src/engine/schema/Schema.spec.ts +++ b/src/engine/schema/Schema.spec.ts @@ -54,7 +54,7 @@ describe('Schema', () => { const schema = new Schema({}); function fn1() { - schema.addEntity(); + schema.addEntity(undefined); } function fn2() { @@ -88,21 +88,21 @@ describe('Schema', () => { function fn2() { // eslint-disable-next-line no-new new Schema({ - entities: {}, + entities: ({} as unknown) as Entity[], }); } function fn3() { // eslint-disable-next-line no-new new Schema({ - entities: 'so-wrong', + entities: ('so-wrong' as unknown) as Entity[], }); } function fn4() { // eslint-disable-next-line no-new new Schema({ - entities: ['so-wrong'], + entities: (['so-wrong'] as unknown) as Entity[], }); } diff --git a/src/engine/storage/StorageType.spec.ts b/src/engine/storage/StorageType.spec.ts index 3c6f92db..b019df7b 100644 --- a/src/engine/storage/StorageType.spec.ts +++ b/src/engine/storage/StorageType.spec.ts @@ -8,6 +8,7 @@ import { passOrThrow } from '../util'; import { StorageTypeNull } from './StorageTypeNull'; import { DataTypeID, DataTypeString } from '../datatype/dataTypes'; +import { DataType } from '../datatype/DataType'; describe('StorageType', () => { it('should have a name', () => { @@ -135,7 +136,7 @@ describe('StorageType', () => { it('should reject invalid schema data types', () => { function fn() { - SomeStorageType.addDataTypeMap({ some: 'thing' }, StorageDataTypeText); + SomeStorageType.addDataTypeMap(({ some: 'thing' } as unknown) as DataType, StorageDataTypeText); } expect(fn).toThrowErrorMatchingSnapshot(); @@ -143,7 +144,7 @@ describe('StorageType', () => { it('should reject invalid storage data types', () => { function fn() { - SomeStorageType.addDataTypeMap(DataTypeString, { someThing: 'else' }); + SomeStorageType.addDataTypeMap(DataTypeString, ({ someThing: 'else' } as unknown) as StorageDataType); } expect(fn).toThrowErrorMatchingSnapshot(); diff --git a/src/engine/subscription/Subscription.spec.ts b/src/engine/subscription/Subscription.spec.ts index 4063ba37..1b8cfcfd 100644 --- a/src/engine/subscription/Subscription.spec.ts +++ b/src/engine/subscription/Subscription.spec.ts @@ -14,7 +14,7 @@ import { Entity } from '../entity/Entity'; import { DataTypeString } from '../datatype/dataTypes'; import { passOrThrow } from '../util'; import { generateTestSchema } from '../../graphqlProtocol/test-helper'; -import { generateGraphQLSchema } from '../../graphqlProtocol/generator'; +import { generateGraphQLSchema } from '../../graphqlProtocol'; import { subscribe, parse } from 'graphql'; describe('Subscription', () => { @@ -58,7 +58,7 @@ describe('Subscription', () => { // eslint-disable-next-line no-new new Subscription({ name: 'example', - type: 12346, + type: (12346 as unknown) as string, }); } @@ -97,7 +97,7 @@ describe('Subscription', () => { name: 'example', type: SUBSCRIPTION_TYPE_CREATE, description: 'subscribe the world', - attributes: ['anything', { foo: 'bar' }], + attributes: ['anything', ({ foo: 'bar' } as unknown) as string], }); function fn() { @@ -166,7 +166,7 @@ describe('Subscription', () => { type: SUBSCRIPTION_TYPE_CREATE, description: 'mutate the world', attributes: ['anything'], - preProcessor: 'not-a-function', + preProcessor: 'not-a-function' as any, }); } @@ -181,7 +181,7 @@ describe('Subscription', () => { type: SUBSCRIPTION_TYPE_CREATE, description: 'mutate the world', attributes: ['anything'], - postProcessor: 'not-a-function', + postProcessor: 'not-a-function'as any, }); } @@ -234,7 +234,7 @@ describe('Subscription', () => { }; function fn() { - processEntitySubscriptions(entity, subscriptions); + processEntitySubscriptions(entity, (subscriptions as unknown) as Subscription[]); } expect(fn).toThrowErrorMatchingSnapshot(); @@ -244,7 +244,7 @@ describe('Subscription', () => { const subscriptions = [{ foo: 'bar' }]; function fn() { - processEntitySubscriptions(entity, subscriptions); + processEntitySubscriptions(entity, (subscriptions as unknown) as Subscription[]); } expect(fn).toThrowErrorMatchingSnapshot(); @@ -366,7 +366,7 @@ describe('Subscription', () => { _id, _source, input, - typeName, + _typeName, entitySubscription, ) => { if (entitySubscription.attributes && Object.keys(input).length) { @@ -489,9 +489,9 @@ describe('Subscription', () => { _entity, // _id, _source, - input, - typeName, - entitySubscription, + _input, + _typeName, + _entitySubscription, context, ) => { if (context && context.changePayload) { diff --git a/src/engine/util.spec.ts b/src/engine/util.spec.ts index 78e04bc3..0fba8f2c 100644 --- a/src/engine/util.spec.ts +++ b/src/engine/util.spec.ts @@ -70,14 +70,14 @@ describe('util', () => { }); it('should reject non-maps', () => { - expect(isMap()).toBe(false); + expect(isMap(undefined)).toBe(false); expect(isMap(null)).toBe(false); expect(isMap(undefined)).toBe(false); expect(isMap([])).toBe(false); expect(isMap([1, 2, 3])).toBe(false); // eslint-disable-next-line @typescript-eslint/no-empty-function expect(isMap(() => {})).toBe(false); - expect(isMap(1234567)).toBe(false); + expect(isMap((1234567 as unknown) as Record)).toBe(false); }); it('should reject empty maps if flag `nonEmpty` is set', () => { @@ -93,7 +93,7 @@ describe('util', () => { }); it('should reject non-arrays', () => { - expect(isArray()).toBe(false); + expect(isArray(undefined)).toBe(false); expect(isArray(null)).toBe(false); expect(isArray(undefined)).toBe(false); expect(isArray(Object.create({}))).toBe(false); @@ -143,7 +143,7 @@ describe('util', () => { it('should throw if non-maps are provided', () => { function fn1() { - mergeMaps(); + mergeMaps(undefined, undefined); } function fn2() { @@ -184,15 +184,15 @@ describe('util', () => { it('should throw if non-maps are provided', () => { function fn1() { - mapOverProperties(); + mapOverProperties(undefined, undefined); } function fn2() { - mapOverProperties([]); + mapOverProperties(([] as unknown) as Record, undefined); } function fn3() { - mapOverProperties('string'); + mapOverProperties(('string' as unknown) as Record, undefined); } expect(fn1).toThrowErrorMatchingSnapshot(); @@ -202,15 +202,15 @@ describe('util', () => { it('should throw if iteratee is not a function', () => { function fn1() { - mapOverProperties({}); + mapOverProperties(({}as unknown) as Record, undefined); } function fn2() { - mapOverProperties({}, []); + mapOverProperties({}, [] as undefined); } function fn3() { - mapOverProperties({}, 'string'); + mapOverProperties({}, 'string' as undefined); } expect(fn1).toThrowErrorMatchingSnapshot(); @@ -221,9 +221,9 @@ describe('util', () => { describe('sortDataByKeys', () => { it('should return empty result if keys list is empty or invalid', () => { - const result1 = sortDataByKeys([], { a: 1, b: 3 }); - const result2 = sortDataByKeys({}, { a: 1, b: 3 }); - const result3 = sortDataByKeys(null, { a: 1, b: 3 }); + const result1 = sortDataByKeys([], ({ a: 1, b: 3 } as unknown) as unknown[]); + const result2 = sortDataByKeys(({} as unknown) as string[], ({ a: 1, b: 3 } as unknown) as unknown[]); + const result3 = sortDataByKeys(null, ({ a: 1, b: 3 } as unknown) as unknown[]); expect(result1).toEqual([]); expect(result2).toEqual([]); @@ -232,7 +232,7 @@ describe('util', () => { it('should return null-filled array if data list is empty or invalid', () => { const result1 = sortDataByKeys(['a', 'b'], null); - const result2 = sortDataByKeys(['a'], {}); + const result2 = sortDataByKeys(['a'], ({} as unknown) as unknown[]); const result3 = sortDataByKeys(['a', 'b', 'f'], []); expect(result1).toEqual([null, null]); diff --git a/src/graphqlProtocol/filter.spec.ts b/src/graphqlProtocol/filter.spec.ts index a1f27925..5093c99f 100644 --- a/src/graphqlProtocol/filter.spec.ts +++ b/src/graphqlProtocol/filter.spec.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/camelcase */ /* eslint-disable @typescript-eslint/explicit-function-return-type */ import { @@ -45,7 +44,7 @@ describe('filter', () => { }, }); - extendModelsForGql([filteredEntity]); + extendModelsForGql({ filteredEntity }); describe('splitAttributeAndFilterOperator', () => { it('should split attributes from operators', () => { @@ -89,7 +88,7 @@ describe('filter', () => { it('should fail on wrong inputs', () => { function fn1() { - splitAttributeAndFilterOperator(); + splitAttributeAndFilterOperator(undefined); } function fn2() { @@ -253,7 +252,7 @@ describe('filter', () => { it('should throw if provided params are invalid', async () => { expect( - transformFilterLevel(filteredEntity, 'a'), + transformFilterLevel(filteredEntity, 'a' as any, undefined), ).rejects.toThrowErrorMatchingSnapshot(); expect( diff --git a/test/mutation.spec.ts b/test/mutation.spec.ts index ccf099a4..c44bb0e4 100644 --- a/test/mutation.spec.ts +++ b/test/mutation.spec.ts @@ -1,3 +1,4 @@ +/* eslint-disable dot-notation */ import './setupAndTearDown'; import { mutate, findOneByValue, testGraphql } from './db'; @@ -81,7 +82,7 @@ describe('mutation', () => { null, asUser(84), ); - const inviteId = result.id; + const inviteId = result['id']; expect(removeDynamicData(BoardMember, result)).toMatchSnapshot(); result = await mutate(BoardMember, 'accept', {}, inviteId, asUser(80)); @@ -153,11 +154,11 @@ describe('mutation', () => { null, asUser(84), ); - const inviteId = result.id; + const inviteId = result['id']; expect(removeDynamicData(BoardMember, result)).toMatchSnapshot(); result = await mutate(BoardMember, 'remove', {}, inviteId, asUser(84)); - result.rows = removeListDynamicData(BoardMember, result.rows); + result['rows'] = removeListDynamicData(BoardMember, result['rows']); expect(removeDynamicData(BoardMember, result)).toMatchSnapshot(); }); @@ -174,7 +175,7 @@ describe('mutation', () => { null, asUser(84), ); - const inviteId = result.id; + const inviteId = result['id']; await mutate(BoardMember, 'accept', {}, inviteId, asUser(81)); diff --git a/test/storageDataTypes.spec.ts b/test/storageDataTypes.spec.ts index b8588446..c1b03040 100644 --- a/test/storageDataTypes.spec.ts +++ b/test/storageDataTypes.spec.ts @@ -31,7 +31,8 @@ describe('storageDataTypes', () => { expect(persist).toMatchSnapshot(); - const result = await findOne(DataTypeTester, persist.id, {}, asAdmin()); + // eslint-disable-next-line dot-notation + const result = await findOne(DataTypeTester, persist['id'], {}, asAdmin()); expect(result).toMatchSnapshot(); }); });