Skip to content
Permalink
Browse files

chore(tests): adds a bunch of test coverage (#163)

* chore(tests): add more test coverage

* more tests and cleanup

* more tests and cleanup

* more tests and cleanup

* more tests: up to 86.66 coverage
  • Loading branch information...
goldcaddy77 committed Jul 27, 2019
1 parent 1266ca6 commit 3f226f510f23a6c2fa902f23b8e7ea6127e292ec
Showing with 3,569 additions and 369 deletions.
  1. +1 −5 .circleci/config.yml
  2. +6 −3 .vscode/launch.json
  3. +3 −2 .vscode/tasks.json
  4. +1 −1 examples/7-feature-flags/tools/seed.ts
  5. +9 −1 package.json
  6. +802 −0 sinks.json
  7. +0 −9 src/cli/.env.test
  8. +0 −98 src/cli/cli-integration.test.ts
  9. +1 −3 src/cli/cli.ts
  10. +1 −2 src/cli/commands/generate.ts
  11. +1 −2 src/cli/commands/migrationGenerate.ts
  12. +0 −13 src/cli/config.ts
  13. +35 −20 src/cli/extensions/db-extension.ts
  14. +4 −15 src/core/config.test.ts
  15. +18 −18 src/core/config.ts
  16. +0 −26 src/core/server.test.ts
  17. +2 −2 src/core/server.ts
  18. +1 −1 src/core/tests/dotenv-files/dotenv.test.ts
  19. +1 −1 src/core/tests/invalid-config-file/config.test.ts
  20. +3 −3 src/core/tests/valid-config-file/config.test.ts
  21. +2 −3 src/decorators/EnumField.test.ts
  22. +2 −2 src/decorators/EnumField.ts
  23. +2 −2 src/decorators/ManyToOne.ts
  24. +3 −2 src/decorators/Model.ts
  25. 0 src/middleware/{ErrorMiddleware.ts → ErrorMiddleware.ts.bak}
  26. +1 −1 src/middleware/index.ts
  27. 0 src/torm/{EverythingSubscriber.ts → EverythingSubscriber.ts.bak}
  28. +1 −1 src/torm/index.ts
  29. +98 −0 src/utils/decoratorComposer.test.ts
  30. +7 −7 src/utils/decoratorComposer.ts
  31. +0 −1 src/utils/index.ts
  32. +0 −6 src/utils/object-to-model.ts
  33. +2 −2 src/utils/object.test.ts
  34. +2 −2 src/utils/string.test.ts
  35. +300 −0 test/functional/__snapshots__/server.test.ts.snap
  36. +212 −0 test/functional/cli.test.ts
  37. +841 −0 test/functional/fixtures.ts
  38. +243 −0 test/functional/server.test.ts
  39. +157 −19 test/generated/binding.ts
  40. +240 −28 test/generated/classes.ts
  41. +158 −21 test/generated/schema.graphql
  42. +69 −0 test/helpers.ts
  43. +14 −0 test/modules/dish/dish.model.ts
  44. +86 −0 test/modules/dish/dish.resolver.ts
  45. +13 −0 test/modules/dish/dish.service.ts
  46. +2 −0 test/modules/index.ts
  47. +47 −0 test/modules/kitchen-sink/kitchen-sink.model.ts
  48. +94 −0 test/modules/kitchen-sink/kitchen-sink.resolver.ts
  49. +16 −0 test/modules/kitchen-sink/kitchen-sink.service.ts
  50. +0 −7 test/modules/user/user.model.ts
  51. +0 −22 test/modules/user/user.resolver.ts
  52. +49 −0 test/server-vars.ts
  53. +18 −17 test/test-server.ts
  54. +1 −1 tsconfig.json
@@ -19,11 +19,7 @@ jobs:
command: yarn build
- run:
name: test
command: yarn jest --coverage --ci --forceExit --detectOpenHandles --runInBand
- run:
name: test-seed
# TODO: This should be an actual Jest test, but I figured it gives more coverage and already have it
command: yarn test:seed
command: yarn test:prod
- run:
name: deploy
command: yarn run semantic-release || true
@@ -5,14 +5,17 @@
"name": "Jest",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/jest-cli/bin/jest.js",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"stopOnEntry": false,
"args": ["--runInBand", "${file}"],
"cwd": "${workspaceRoot}",
"protocol": "legacy",
"internalConsoleOptions": "openOnSessionStart",
"runtimeArgs": ["--nolazy"],
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/dist/**/*.js"]
"outFiles": ["${workspaceRoot}/dist/**/*.js"],
"env": {
"DEBUG": "*"
}
},
{
"name": "Run from index.ts",
@@ -2,9 +2,10 @@
"version": "2.0.0",
"tasks": [
{
"command": "source tools/environment_setup.sh",
"command": "yarn jest --verbose ${file}",
"type": "shell",
"label": "setupEnvironment"
"label": "jest-current-file",
"problemMatcher": []
},
{
"label": "build",
@@ -235,7 +235,7 @@ async function createProject(binding: Binding): Promise<Project> {
{
data: {
key: `proj-${new Date().getTime()}`,
name: `Marketplace ${new Date().getTime()}`
name: `My Project ${new Date().getTime()}`
}
},
`{ id key name createdAt }`
@@ -26,7 +26,8 @@
"prettify": "yarn prettier './+(examples|src|test|tools)/**/*.ts' --write",
"semantic-release": "semantic-release",
"test": "jest --verbose --coverage",
"test:seed": "cd examples/1-simple-model && DEBUG=* NODE_ENV=development WARTHOG_MOCK_DATABASE=true yarn db:seed:dev && rm warthog.sqlite.tmp",
"//verbose": "--verbose flag must be used to accurately test the CLI writing to stdout",
"test:prod": "yarn jest --coverage --ci --detectOpenHandles --runInBand --verbose",
"test:watch": "jest --verbose --watch"
},
"husky": {
@@ -165,6 +166,13 @@
"modulePathIgnorePatterns": [
"/examples/"
],
"watchPathIgnorePatterns": [
"tmp/",
"/generated/*"
],
"collectCoverageFrom": [
"src/**/*.ts"
],
"coveragePathIgnorePatterns": [
"/node_modules/",
"\\.test\\.ts$"

0 comments on commit 3f226f5

Please sign in to comment.
You can’t perform that action at this time.