Skip to content

Commit 452a40c

Browse files
committed
chore: clean up integration tests as it isn't necessary
1 parent 75beadd commit 452a40c

7 files changed

Lines changed: 127 additions & 1986 deletions

package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"test:smoke": "config/scripts/smoke.sh",
2020
"test:ts": "tsc -p test/typings/tsconfig.json",
2121
"test:focused": "node node_modules/ts-node/dist/bin.js --project=test/tsconfig.json test/focusedTest.ts",
22-
"codegen:test": "graphql-codegen --config test/graphql-api/typed-document-node.codegen.yml",
2322
"prepublishOnly": "yarn lint && yarn test:unit && yarn build && yarn test:integration",
2423
"postinstall": "node -e \"try{require('./config/scripts/postinstall')}catch(e){}\""
2524
},
@@ -89,10 +88,6 @@
8988
"devDependencies": {
9089
"@babel/core": "^7.14.3",
9190
"@babel/preset-env": "^7.14.2",
92-
"@graphql-codegen/cli": "^1.21.5",
93-
"@graphql-codegen/typed-document-node": "^1.18.6",
94-
"@graphql-codegen/typescript": "^1.22.1",
95-
"@graphql-codegen/typescript-operations": "^1.18.0",
9691
"@open-draft/test-server": "^0.2.3",
9792
"@rollup/plugin-commonjs": "^19.0.0",
9893
"@rollup/plugin-inject": "^4.0.2",

test/graphql-api/typed-document-node.graphql-operations.ts renamed to src/graphql.test-data.ts

File renamed without changes.

src/graphql.test.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
import { graphql } from './graphql'
2+
import {
3+
GetUserDetailDocument,
4+
GetUserDetailQueryVariables,
5+
LoginDocument,
6+
LoginMutationVariables,
7+
} from './graphql.test-data'
28

39
test('exports supported GraphQL operation types', () => {
410
expect(graphql).toBeDefined()
@@ -9,3 +15,25 @@ test('exports supported GraphQL operation types', () => {
915
'link',
1016
])
1117
})
18+
19+
test('pass proper type to request variable and data payload parameter for query', () => {
20+
const op = graphql.query(GetUserDetailDocument, (req, res, ctx) => {
21+
// If type doesn't match, this should fail compilation
22+
const variables: GetUserDetailQueryVariables = req.variables
23+
24+
// MANUAL VERIFICATION: intellisense on `ctx.data` should be of type `DataContext<GetUserDetailQuery>`.
25+
// Not sure how to test this.
26+
ctx.data
27+
})
28+
})
29+
30+
test('pass proper type to request variable and data payload parameter for mutation', () => {
31+
const op = graphql.mutation(LoginDocument, (req, res, ctx) => {
32+
// If type doesn't match, this should fail compilation
33+
const variables: LoginMutationVariables = req.variables
34+
35+
// MANUAL VERIFICATION: intellisense on `ctx.data` should be of type `DataContext<LoginMutation>`.
36+
// Not sure how to test this.
37+
ctx.data
38+
})
39+
})

test/graphql-api/typed-document-node.codegen.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

test/graphql-api/typed-document-node.node.test.ts

Lines changed: 0 additions & 109 deletions
This file was deleted.

test/graphql-api/typed-document-node.schema.graphql

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)