-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9bb7b6b
commit db7a960
Showing
12 changed files
with
122 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import packageJson from '../package.json' with { type: 'json' }; | ||
|
||
export default { | ||
...packageJson.ava, | ||
environmentVariables: { | ||
...packageJson.ava.environmentVariables, | ||
TS_NODE_PROJECT: './tests/tsconfig.docker.json', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2022", | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"rootDir": ".", | ||
"outDir": "../lib/tests", | ||
"verbatimModuleSyntax": false, | ||
"tsBuildInfoFile": "../lib/tests/.tsbuildinfo" | ||
}, | ||
"include": [".", "utils"], | ||
"exclude": [], | ||
"ts-node": { | ||
"esm": true, | ||
"compilerOptions": { | ||
"module": "ESNext", | ||
"moduleResolution": "Node" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,37 @@ | ||
export const gql = '/graphql'; | ||
import { INestApplication } from '@nestjs/common'; | ||
import type { Response } from 'supertest'; | ||
import supertest from 'supertest'; | ||
|
||
export function handleGraphQLError(resp: Response) { | ||
const { errors } = resp.body; | ||
if (errors) { | ||
const cause = errors[0]; | ||
const stacktrace = cause.extensions?.stacktrace; | ||
throw new Error( | ||
stacktrace | ||
? Array.isArray(stacktrace) | ||
? stacktrace.join('\n') | ||
: String(stacktrace) | ||
: cause.message, | ||
cause | ||
); | ||
} | ||
} | ||
|
||
export function gql(app: INestApplication, query?: string) { | ||
const req = supertest(app.getHttpServer()) | ||
.post('/graphql') | ||
.set({ 'x-request-id': 'test', 'x-operation-name': 'test' }); | ||
|
||
if (query) { | ||
return req.send({ query }); | ||
} | ||
|
||
return req; | ||
} | ||
|
||
export const gqlEndpoint = '/graphql'; | ||
|
||
export async function sleep(ms: number) { | ||
return new Promise(resolve => setTimeout(resolve, ms)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.