Add schema file, also add instructions to readme

This commit is contained in:
Ramon Wenger 2020-01-07 14:33:20 +01:00 committed by Ramon Wenger
parent cfde20c67c
commit cdb2570203
7 changed files with 15151 additions and 13 deletions

2
.gitignore vendored
View File

@ -29,7 +29,7 @@ node_modules
# Backend # Backend
staticfiles staticfiles
schema.json server/schema.json
# Wagtail assets # Wagtail assets
server/documents server/documents

View File

@ -176,3 +176,23 @@ You can and should then push the tag to the repo
You can later see the metadata of the tag with You can later see the metadata of the tag with
git show release/v2019-09-10 git show release/v2019-09-10
## Testing
## Mocking GraphQL calls
We use [cypress-graphql-mock](https://github.com/tgriesser/cypress-graphql-mock) for mocking GraphQL calls in Cypress tests.
For an example, please see `spellcheck.spec.js`.
There is a schema.json in the fixtures folder. For now it has been generated once, and if there is a significant update to the schema on the server, it has to be regenerated.
To generate a new schema, use the management command
```
python manage.py graphql_schema --schema api.schema.schema --out schema.json --indent 4
```
Then, remove the `data` property from the generated `schema.json`, so the `__schema` property is on the top level.
Also remove the two objects with `"name": "__debug"` from the JSON file.

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
const schema = require('../../../schema_formatted.json'); const schema = require('../fixtures/schema.json');
describe('Spellcheck', () => { describe('Spellcheck', () => {
beforeEach(() => { beforeEach(() => {

View File

@ -1,5 +0,0 @@
.taskbase {
&__correction {
background: yellow;
}
}

View File

@ -22,4 +22,3 @@
@import "public-page"; @import "public-page";
@import "student-submission"; @import "student-submission";
@import "module-activity"; @import "module-activity";
@import "taskbase";

10
package-lock.json generated
View File

@ -9,9 +9,9 @@
"resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz", "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz",
"integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=", "integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=",
"requires": { "requires": {
"babel-runtime": "6.26.0", "babel-runtime": "^6.26.0",
"core-js": "2.5.7", "core-js": "^2.5.0",
"regenerator-runtime": "0.10.5" "regenerator-runtime": "^0.10.5"
} }
}, },
"babel-runtime": { "babel-runtime": {
@ -19,8 +19,8 @@
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"requires": { "requires": {
"core-js": "2.5.7", "core-js": "^2.4.0",
"regenerator-runtime": "0.11.1" "regenerator-runtime": "^0.11.0"
}, },
"dependencies": { "dependencies": {
"regenerator-runtime": { "regenerator-runtime": {