Skip to content

Latest commit

 

History

History
49 lines (32 loc) · 1.24 KB

File metadata and controls

49 lines (32 loc) · 1.24 KB

@eddeee888/gcg-typescript-resolver-files

Guidelines

  • Lean into config and types generated by @graphql-codegen/typescript and @graphql-codegen/typescript-resolvers

Testing

Unit Tests

Create unit test files next to the implementation:

functionA.ts
functionA.spec.ts # Here's the unit test file

Run unit tests in this package:

nx test typescript-resolver-files

E2E Test

Create new E2E Test

Create new e2e test setup (with own codegen.yml and schema files) from template:

nx g @graphql-code-generator-plugins/workspace-plugin:typescript-resolver-files-add-e2e-test <test-name-in-kebab-case>

Run E2E Test/s

The expected output of each test are the files generated by running codegen command, then committed. In CI/CD, all e2e tests are run and if there is a difference between the generated version in CI vs committed version, it will fail. In a way, this is similar to Jest's snapshot testing.

# Run one e2e test with no assertion
nx graphql-codegen typescript-resolver-files-e2e -c <test-name> --verbose

# Run all tests with no assertion
nx e2e-run typescript-resolver-files-e2e -c clean-run

# Run tests and assert. This is run in CI/CD.
nx e2e typescript-resolver-files-e2e