Skip to content

Commit

Permalink
fix specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Schroeder committed Sep 15, 2023
1 parent 0d04947 commit aed8188
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 73 deletions.
92 changes: 46 additions & 46 deletions spec/src/soap2graphql/default-type-resolver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,58 +18,58 @@ describe('DefaultTypeResolver', () => {
it('resolves default scalar types', async () => {
const resolver = new DefaultTypeResolver();

expect(resolver.resolve(null)).to.not.exist;
expect(resolver.resolve(undefined)).to.not.exist;
expect(resolver.resolve(null, '')).to.not.exist;
expect(resolver.resolve(undefined, '')).to.not.exist;

expect(resolver.resolve('lalal')).to.not.exist;
expect(resolver.resolve('lalal', '')).to.not.exist;

expect(resolver.resolve('string')).to.equal(GraphQLString);
expect(resolver.resolve('base64Binary')).to.equal(GraphQLString);
expect(resolver.resolve('hexBinary')).to.equal(GraphQLString);
expect(resolver.resolve('duration')).to.equal(GraphQLString);
expect(resolver.resolve('gYearMonth')).to.equal(GraphQLString);
expect(resolver.resolve('gYear')).to.equal(GraphQLString);
expect(resolver.resolve('gMonthDay')).to.equal(GraphQLString);
expect(resolver.resolve('gDay')).to.equal(GraphQLString);
expect(resolver.resolve('gMonth')).to.equal(GraphQLString);
expect(resolver.resolve('anyURI')).to.equal(GraphQLString);
expect(resolver.resolve('QName')).to.equal(GraphQLString);
expect(resolver.resolve('normalizedString')).to.equal(GraphQLString);
expect(resolver.resolve('token')).to.equal(GraphQLString);
expect(resolver.resolve('NMTOKEN')).to.equal(GraphQLString);
expect(resolver.resolve('NMTOKENS')).to.equal(GraphQLString);
expect(resolver.resolve('language')).to.equal(GraphQLString);
expect(resolver.resolve('Name')).to.equal(GraphQLString);
expect(resolver.resolve('NCName')).to.equal(GraphQLString);
expect(resolver.resolve('IDREF')).to.equal(GraphQLString);
expect(resolver.resolve('IDREFS')).to.equal(GraphQLString);
expect(resolver.resolve('ENTITY')).to.equal(GraphQLString);
expect(resolver.resolve('ENTITIES')).to.equal(GraphQLString);
expect(resolver.resolve('string', '')).to.equal(GraphQLString);
expect(resolver.resolve('base64Binary', '')).to.equal(GraphQLString);
expect(resolver.resolve('hexBinary', '')).to.equal(GraphQLString);
expect(resolver.resolve('duration', '')).to.equal(GraphQLString);
expect(resolver.resolve('gYearMonth', '')).to.equal(GraphQLString);
expect(resolver.resolve('gYear', '')).to.equal(GraphQLString);
expect(resolver.resolve('gMonthDay', '')).to.equal(GraphQLString);
expect(resolver.resolve('gDay', '')).to.equal(GraphQLString);
expect(resolver.resolve('gMonth', '')).to.equal(GraphQLString);
expect(resolver.resolve('anyURI', '')).to.equal(GraphQLString);
expect(resolver.resolve('QName', '')).to.equal(GraphQLString);
expect(resolver.resolve('normalizedString', '')).to.equal(GraphQLString);
expect(resolver.resolve('token', '')).to.equal(GraphQLString);
expect(resolver.resolve('NMTOKEN', '')).to.equal(GraphQLString);
expect(resolver.resolve('NMTOKENS', '')).to.equal(GraphQLString);
expect(resolver.resolve('language', '')).to.equal(GraphQLString);
expect(resolver.resolve('Name', '')).to.equal(GraphQLString);
expect(resolver.resolve('NCName', '')).to.equal(GraphQLString);
expect(resolver.resolve('IDREF', '')).to.equal(GraphQLString);
expect(resolver.resolve('IDREFS', '')).to.equal(GraphQLString);
expect(resolver.resolve('ENTITY', '')).to.equal(GraphQLString);
expect(resolver.resolve('ENTITIES', '')).to.equal(GraphQLString);

expect(resolver.resolve('ID')).to.equal(GraphQLID);
expect(resolver.resolve('ID', '')).to.equal(GraphQLID);

expect(resolver.resolve('boolean')).to.equal(GraphQLBoolean);
expect(resolver.resolve('boolean', '')).to.equal(GraphQLBoolean);

expect(resolver.resolve('byte')).to.equal(GraphQLInt);
expect(resolver.resolve('unsignedByte')).to.equal(GraphQLInt);
expect(resolver.resolve('short')).to.equal(GraphQLInt);
expect(resolver.resolve('unsignedShort')).to.equal(GraphQLInt);
expect(resolver.resolve('int')).to.equal(GraphQLInt);
expect(resolver.resolve('unsignedInt')).to.equal(GraphQLInt);
expect(resolver.resolve('integer')).to.equal(GraphQLInt);
expect(resolver.resolve('positiveInteger')).to.equal(GraphQLInt);
expect(resolver.resolve('nonPositiveInteger')).to.equal(GraphQLInt);
expect(resolver.resolve('negativeInteger')).to.equal(GraphQLInt);
expect(resolver.resolve('nonNegativeInteger')).to.equal(GraphQLInt);
expect(resolver.resolve('long')).to.equal(GraphQLInt);
expect(resolver.resolve('unsignedLong')).to.equal(GraphQLInt);
expect(resolver.resolve('byte', '')).to.equal(GraphQLInt);
expect(resolver.resolve('unsignedByte', '')).to.equal(GraphQLInt);
expect(resolver.resolve('short', '')).to.equal(GraphQLInt);
expect(resolver.resolve('unsignedShort', '')).to.equal(GraphQLInt);
expect(resolver.resolve('int', '')).to.equal(GraphQLInt);
expect(resolver.resolve('unsignedInt', '')).to.equal(GraphQLInt);
expect(resolver.resolve('integer', '')).to.equal(GraphQLInt);
expect(resolver.resolve('positiveInteger', '')).to.equal(GraphQLInt);
expect(resolver.resolve('nonPositiveInteger', '')).to.equal(GraphQLInt);
expect(resolver.resolve('negativeInteger', '')).to.equal(GraphQLInt);
expect(resolver.resolve('nonNegativeInteger', '')).to.equal(GraphQLInt);
expect(resolver.resolve('long', '')).to.equal(GraphQLInt);
expect(resolver.resolve('unsignedLong', '')).to.equal(GraphQLInt);

expect(resolver.resolve('decimal')).to.equal(GraphQLFloat);
expect(resolver.resolve('float')).to.equal(GraphQLFloat);
expect(resolver.resolve('double')).to.equal(GraphQLFloat);
expect(resolver.resolve('decimal', '')).to.equal(GraphQLFloat);
expect(resolver.resolve('float', '')).to.equal(GraphQLFloat);
expect(resolver.resolve('double', '')).to.equal(GraphQLFloat);

expect(resolver.resolve('dateTime')).to.equal(GraphQLDateTime);
expect(resolver.resolve('date')).to.equal(GraphQLDate);
expect(resolver.resolve('time')).to.equal(GraphQLTime);
expect(resolver.resolve('dateTime', '')).to.equal(GraphQLDateTime);
expect(resolver.resolve('date', '')).to.equal(GraphQLDate);
expect(resolver.resolve('time', '')).to.equal(GraphQLTime);
}).timeout(10000);
});
66 changes: 39 additions & 27 deletions spec/src/soap2graphql/name-resolver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,51 +14,63 @@ describe('name-resolver', () => {
it('defaultOutputNameResolver', async () => {
expect(defaultOutputNameResolver(null)).to.not.exist;
expect(defaultOutputNameResolver(undefined)).to.not.exist;
expect(defaultOutputNameResolver({ name: null } as any)).to.not.exist;
expect(defaultOutputNameResolver({ name: undefined } as any)).to.not.exist;
expect(defaultOutputNameResolver({ name: '' } as any)).to.not.exist;
expect(defaultOutputNameResolver({ name: null, namespace: 'N' } as any)).to.not.exist;
expect(defaultOutputNameResolver({ name: undefined, namespace: 'N' } as any)).to.not.exist;
expect(defaultOutputNameResolver({ name: '', namespace: 'N' } as any)).to.not.exist;

expect(defaultOutputNameResolver({ name: 'a' } as any)).to.equal('A');
expect(defaultOutputNameResolver({ name: 'A' } as any)).to.equal('A');
expect(defaultOutputNameResolver({ name: 'a', namespace: '' } as any)).to.equal('_A');
expect(defaultOutputNameResolver({ name: 'A', namespace: '' } as any)).to.equal('_A');

expect(defaultOutputNameResolver({ name: 'ab' } as any)).to.equal('Ab');
expect(defaultOutputNameResolver({ name: 'Ab' } as any)).to.equal('Ab');
expect(defaultOutputNameResolver({ name: 'a', namespace: 'n' } as any)).to.equal('N_A');
expect(defaultOutputNameResolver({ name: 'A', namespace: 'N' } as any)).to.equal('N_A');

expect(defaultOutputNameResolver({ name: 'abc' } as any)).to.equal('Abc');
expect(defaultOutputNameResolver({ name: 'Abc' } as any)).to.equal('Abc');
expect(defaultOutputNameResolver({ name: 'ab', namespace: 'N' } as any)).to.equal('N_Ab');
expect(defaultOutputNameResolver({ name: 'Ab', namespace: 'N' } as any)).to.equal('N_Ab');

expect(defaultOutputNameResolver({ name: 'abc', namespace: 'N' } as any)).to.equal('N_Abc');
expect(defaultOutputNameResolver({ name: 'Abc', namespace: 'N' } as any)).to.equal('N_Abc');
}).timeout(10000);

it('defaultInterfaceNameResolver', async () => {
expect(defaultInterfaceNameResolver(null)).to.not.exist;
expect(defaultInterfaceNameResolver(undefined)).to.not.exist;
expect(defaultInterfaceNameResolver({ name: null } as any)).to.not.exist;
expect(defaultInterfaceNameResolver({ name: undefined } as any)).to.not.exist;
expect(defaultOutputNameResolver({ name: '' } as any)).to.not.exist;
expect(defaultInterfaceNameResolver({ name: null, namespace: 'N' } as any)).to.not.exist;
expect(defaultInterfaceNameResolver({ name: undefined, namespace: 'N' } as any)).to.not
.exist;
expect(defaultOutputNameResolver({ name: '', namespace: 'N' } as any)).to.not.exist;

expect(defaultInterfaceNameResolver({ name: 'a' } as any)).to.equal('iA');
expect(defaultInterfaceNameResolver({ name: 'A' } as any)).to.equal('iA');
expect(defaultInterfaceNameResolver({ name: 'a', namespace: 'N' } as any)).to.equal('iA');
expect(defaultInterfaceNameResolver({ name: 'A', namespace: 'N' } as any)).to.equal('iA');

expect(defaultInterfaceNameResolver({ name: 'ab' } as any)).to.equal('iAb');
expect(defaultInterfaceNameResolver({ name: 'Ab' } as any)).to.equal('iAb');
expect(defaultInterfaceNameResolver({ name: 'ab', namespace: 'N' } as any)).to.equal('iAb');
expect(defaultInterfaceNameResolver({ name: 'Ab', namespace: 'N' } as any)).to.equal('iAb');

expect(defaultInterfaceNameResolver({ name: 'abc' } as any)).to.equal('iAbc');
expect(defaultInterfaceNameResolver({ name: 'Abc' } as any)).to.equal('iAbc');
expect(defaultInterfaceNameResolver({ name: 'abc', namespace: 'N' } as any)).to.equal(
'iAbc',
);
expect(defaultInterfaceNameResolver({ name: 'Abc', namespace: 'N' } as any)).to.equal(
'iAbc',
);
}).timeout(10000);

it('defaultInputNameResolver', async () => {
expect(defaultInputNameResolver(null)).to.not.exist;
expect(defaultInputNameResolver(undefined)).to.not.exist;
expect(defaultInputNameResolver({ name: null } as any)).to.not.exist;
expect(defaultInputNameResolver({ name: undefined } as any)).to.not.exist;
expect(defaultInputNameResolver({ name: '' } as any)).to.not.exist;
expect(defaultInputNameResolver({ name: null, namespace: 'N' } as any)).to.not.exist;
expect(defaultInputNameResolver({ name: undefined, namespace: 'N' } as any)).to.not.exist;
expect(defaultInputNameResolver({ name: '', namespace: 'N' } as any)).to.not.exist;

expect(defaultInputNameResolver({ name: 'a' } as any)).to.equal('AInput');
expect(defaultInputNameResolver({ name: 'A' } as any)).to.equal('AInput');
expect(defaultInputNameResolver({ name: 'a', namespace: 'N' } as any)).to.equal('N_AInput');
expect(defaultInputNameResolver({ name: 'A', namespace: 'N' } as any)).to.equal('N_AInput');

expect(defaultInputNameResolver({ name: 'ab' } as any)).to.equal('AbInput');
expect(defaultInputNameResolver({ name: 'Ab' } as any)).to.equal('AbInput');
expect(defaultInputNameResolver({ name: 'ab', namespace: 'N' } as any)).to.equal('N_AbInput');
expect(defaultInputNameResolver({ name: 'Ab', namespace: 'N' } as any)).to.equal('N_AbInput');

expect(defaultInputNameResolver({ name: 'abc' } as any)).to.equal('AbcInput');
expect(defaultInputNameResolver({ name: 'Abc' } as any)).to.equal('AbcInput');
expect(defaultInputNameResolver({ name: 'abc', namespace: 'N' } as any)).to.equal(
'N_AbcInput',
);
expect(defaultInputNameResolver({ name: 'Abc', namespace: 'N' } as any)).to.equal(
'N_AbcInput',
);
}).timeout(10000);
});

0 comments on commit aed8188

Please sign in to comment.