Skip to content

Commit

Permalink
chore: adjust tests for the new graphql-schema-test implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Leksat committed Jan 16, 2022
1 parent e641cc4 commit a98cbe6
Show file tree
Hide file tree
Showing 16 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
module.exports = {
default(responses) {
maskImageUrl(responses);
return responses;
},
};
const path = require("path");
const {
listFiles,
createExecutor,
} = require("@amazeelabs/graphql-schema-test");

const graphQlConfigPath = path.resolve(__dirname, "../.graphqlconfig");
const queriesPath = path.resolve(__dirname, "queries");

execute = createExecutor(graphQlConfigPath, maskImageUrl);
test.each(listFiles(queriesPath))("%s", async (_, path) => {
await execute(path);
});

// Image URLs contain current date, e.g.
// http://localhost:8888/sites/default/files/2021-01/image.jpg
Expand Down
6 changes: 4 additions & 2 deletions apps/silverback-drupal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
"scripts": {
"prepare": "if php -v && [[ -z $LAGOON ]]; then composer install && yarn setup && yarn snapshot-create && source .envrc && drush silverback-gatsby:schema-export; fi",
"start": "source .envrc && cd web && php -S 127.0.0.1:8888 .ht.router.php",
"start:silent": "yarn start > /tmp/drupal.log 2>&1",
"login": "source .envrc && drush uli",
"setup": "source .envrc && silverback setup",
"snapshot-create": "source .envrc && silverback snapshot-create test -y",
"snapshot-restore": "source .envrc && silverback snapshot-restore test",
"clear": "source .envrc && drush cr",
"test": "composer install && bash vendor/bin/silverback-test",
"test:integration": "yarn snapshot-restore && start-server-and-test start 8888 test:schema",
"test:schema": "yarn graphql-schema-test generated",
"test:integration": "yarn snapshot-restore && start-server-and-test start:silent 8888 test:schema",
"test:schema": "yarn jest --testMatch '<rootDir>/generated/__tests__/test-queries.js'",
"export-content": "web/modules/custom/silverback_gatsby_test/export_content.sh"
},
"dependencies": {
Expand All @@ -26,6 +27,7 @@
},
"devDependencies": {
"@amazeelabs/graphql-schema-test": "^1.0.4",
"jest": "^27.4.7",
"start-server-and-test": "^1.14.0"
}
}

0 comments on commit a98cbe6

Please sign in to comment.