Skip to content

Commit

Permalink
Fix issue with the update of the schema
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelDiz committed Oct 12, 2023
1 parent 803006a commit 5e38c2e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
// globalSetup: '<rootDir>/src/__tests__/setup.ts',
globalSetup: '<rootDir>/src/__tests__/setup.ts',
// globalTeardown: '<rootDir>/src/__tests__/teardown.ts',
testPathIgnorePatterns: ["<rootDir>/src/__tests__/setup.ts", "<rootDir>/src/__tests__/teardown.ts"],
};
3 changes: 0 additions & 3 deletions src/__tests__/query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const client = new ApolloClient({

describe('Mutations', () => {
it('should add User', async () => {
console.log('uri', uri);
const { data } = await client.mutate({
mutation: gql`
mutation MT1 {
Expand All @@ -42,9 +41,7 @@ describe('Mutations', () => {
});

describe('Queries', () => {
console.log('uri', uri);
it('should queryUsers', async () => {
console.log('uri', uri);
const { data } = await client.query({
query: gql`
{
Expand Down
21 changes: 15 additions & 6 deletions src/__tests__/setup.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
module.exports = async () => {
fetch('http://localhost:4001/update-schema', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ }),
});
};
let uri: string;

if (process.env.RUNNING_JEST === 'true' || process.env.NODE_ENV === 'test') {
uri = 'http://app:4001/update-schema';
} else {
uri = 'http://localhost:4001/update-schema';
}

await fetch(uri, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ schema: 'type Query { hello: String }' })
});

};

0 comments on commit 5e38c2e

Please sign in to comment.