Skip to content

Commit fe831c7

Browse files
authored
Integration test improvements (aws#99)
Integration test improvements: -fixed integration tests that were broken due to differing results returned from neptune when the query limit is less than the number of potential results by changing the queries such that they will have a known set of results -fixed neptune query result verification that was failing for expected results that contained an array -added test output folder cleanup -removed tests that checked resolver file size and content as they are not useful now that the schema was separated from the resolver (and these tests require updating any time the resolver is changed) -replaced resolver file size and content checks with checks that test output folder contains expected file -removed integration tests which check the resolved open cypher query as graphQL->cypher query resolution is now covered by the resolver unit test
1 parent da595cb commit fe831c7

39 files changed

+141
-3732
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,5 @@ This release contains new support for Apollo Server integration.
4949
* Added unit tests for resolver and moved resolver integration tests to be unit tests ([#83](https://github.com/aws/amazon-neptune-for-graphql/pull/83))
5050
* Set limit on the expensive query which is retrieving distinct to and from labels for edges ([#89](https://github.com/aws/amazon-neptune-for-graphql/pull/89))
5151
* Added distinct input types for create and update mutations ([#93](https://github.com/aws/amazon-neptune-for-graphql/pull/93))
52-
* Enabled mutations for the Apollo Server ([#98](https://github.com/aws/amazon-neptune-for-graphql/pull/98))
52+
* Enabled mutations for the Apollo Server ([#98](https://github.com/aws/amazon-neptune-for-graphql/pull/98))
53+
* Refactored integration tests to be less vulnerable to resolver logic changes ([#99](https://github.com/aws/amazon-neptune-for-graphql/pull/99))
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
2-
import { jest } from '@jest/globals';
3-
import { readJSONFile, checkOutputFilesSize, checkOutputFilesContent } from '../../testLib';
1+
import { readJSONFile, checkOutputFilesSize, checkOutputFilesContent, checkFolderContainsFiles } from '../../testLib';
42

53
const casetest = readJSONFile('./test/TestCases/Case01/case.json');
64

7-
checkOutputFilesSize('./test/TestCases/Case01/output', casetest.testOutputFilesSize, './test/TestCases/Case01/outputReference');
8-
9-
checkOutputFilesContent('./test/TestCases/Case01/output', casetest.testOutputFilesContent, './test/TestCases/Case01/outputReference');
5+
describe('Validate output files', () => {
6+
const expectedFiles = [
7+
'output.resolver.graphql.js',
8+
'output.jsresolver.graphql.js',
9+
'output.resolver.schema.json',
10+
'output.schema.graphql',
11+
'output.source.schema.graphql'
12+
];
13+
checkFolderContainsFiles('./test/TestCases/Case01/output', expectedFiles);
14+
checkOutputFilesSize('./test/TestCases/Case01/output', casetest.testOutputFilesSize, './test/TestCases/Case01/outputReference');
15+
checkOutputFilesContent('./test/TestCases/Case01/output', casetest.testOutputFilesContent, './test/TestCases/Case01/outputReference');
16+
});
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
import { readJSONFile, testResolverQueriesResults } from '../../testLib';
2+
import fs from "fs";
13

2-
import { jest } from '@jest/globals';
3-
import { testResolverQueries } from '../../testLib';
4+
const casetest = readJSONFile('./test/TestCases/Case01/case.json');
45

5-
6-
await testResolverQueries('./TestCases/Case01/output/output.resolver.graphql.js', './test/TestCases/Case01/queries', './test/TestCases/Case01/output/output.resolver.schema.json');
6+
try {
7+
await testResolverQueriesResults( './TestCases/Case01/output/output.resolver.graphql.js',
8+
'./test/TestCases/Case01/queries',
9+
'./test/TestCases/Case01/output/output.resolver.schema.json',
10+
casetest.host,
11+
casetest.port);
12+
} finally {
13+
fs.rmSync('./test/TestCases/Case01/output', {recursive: true});
14+
}

test/TestCases/Case01/Case01.04.test.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

test/TestCases/Case01/Case01.05.test.js

Lines changed: 0 additions & 144 deletions
This file was deleted.

test/TestCases/Case01/case.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"--output-no-lambda-zip"],
1010
"host": "<AIR_ROUTES_DB_HOST>",
1111
"port": "<AIR_ROUTES_DB_PORT>",
12-
"testOutputFilesSize": ["output.jsresolver.graphql.js", "output.resolver.graphql.js", "output.schema.graphql", "output.source.schema.graphql"],
12+
"testOutputFilesSize": ["output.schema.graphql", "output.source.schema.graphql"],
1313
"testOutputFilesContent": ["output.schema.graphql", "output.source.schema.graphql"]
1414
}

0 commit comments

Comments
 (0)