Skip to content

Commit e62f8a5

Browse files
committed
with tests
1 parent e91d8d0 commit e62f8a5

37 files changed

+39182
-23755
lines changed

README.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
Build query arguments for filter and orderBy MongoDB queries.
66

7-
** This is still under development **
8-
** TODO: prepare proper end-to-end test cases for the different filters **
7+
Added 61 test cases, which pass against my local server.
8+
TODO: There can be more test cases, with complex queries and a critical review of the tests.
9+
TODO: test app to run those test cases against. Used so far my local server.
10+
TODO: When server is up and running: rename src/__tests__/end-to-end/index-test-cases.js back to index-test-cases-test.js, in order to have it in the test run with Mocha.
911

1012
## Purpose
1113
You build a GraphQL server with the npm package "create-graphql-server", which serves as a backend to web applications. This "create-graphql-server" generates schemas, resolvers and models for an express-js server.
@@ -164,21 +166,18 @@ export default typeDefs;
164166
Caution: Do the same again in the "test/output-app/schema/index.js" to have proper test runs.
165167

166168
### Installation Part 4 -- Generator for Schema for individual argument type definitions
167-
Add to file "generate/index.js" the following two statements:
169+
Add to file "generate/schema/index.js" the following two statements:
168170
```javascript
169171
...
170172
import {
171173
enhanceSchemaWithQueryArguments
172-
} from 'create-graphql-server-query-arguments'; // <===
173-
174-
export default function generate(inputSchemaStr) {
175-
const inputSchema = parse(inputSchemaStr);
176-
const type = inputSchema.definitions[0];
177-
const TypeName = type.name.value;
178-
const typeName = lcFirst(TypeName);
179-
const outputSchema = generateSchema(inputSchema);
180-
const enhancedSchema = enhanceSchemaWithQueryArguments(outputSchema); // <===
174+
} from 'create-graphql-server-query-arguments'; // <== here
181175
...
176+
...
177+
// at the end enhance with query arguments...
178+
const outputSchemaWithArguments = enhanceSchemaWithQueryArguments(outputSchemaWithAuth); // <== here
179+
180+
return outputSchemaWithArguments; // <== here
182181
}
183182
```
184183

@@ -196,4 +195,11 @@ yarn test
196195
## Contributing
197196
In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.
198197

198+
# Example Queries
199+
200+
```javascript
201+
202+
```
199203

204+
Have a look in the test directory to see more:
205+
[index-test-cases](https://github.com/tobkle/create-graphql-server-query-arguments/tree/master/src/__tests__/end-to-end/)

0 commit comments

Comments
 (0)