Skip to content

Commit 81f153f

Browse files
committed
Fix tests
1 parent 51a614d commit 81f153f

File tree

12 files changed

+147
-128
lines changed

12 files changed

+147
-128
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"@changesets/cli": "2.29.4",
5656
"@envelop/core": "5.3.0",
5757
"@theguild/prettier-config": "3.0.1",
58-
"@types/jest": "29.5.14",
58+
"@types/jest": "30.0.0",
5959
"@types/node": "22.15.33",
6060
"@typescript-eslint/eslint-plugin": "8.32.1",
6161
"@typescript-eslint/parser": "8.32.1",

packages/load/tests/loaders/schema/schema-from-string.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe('schema from string', () => {
9595
load(schemaString, {
9696
loaders: [new GraphQLFileLoader()],
9797
}),
98-
).rejects.toThrowError('Syntax Error');
98+
).rejects.toThrow('Syntax Error');
9999
});
100100
});
101101
});

packages/loaders/code-file/tests/load-from-code-file.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ describe('loadFromCodeFileSync', () => {
108108
const doc = loaded?.document ? loaded?.document : parse(loaded?.rawSDL!);
109109

110110
expect(doc?.kind).toEqual('Document');
111-
}).toThrowError('Syntax Error: Unexpected Name "InvalidGetUser"');
111+
}).toThrow('Syntax Error: Unexpected Name "InvalidGetUser"');
112112
});
113113

114114
it('should raise an error when the glob matches valid and invalid schema files with `noSilentErrors` set to true', async () => {

packages/loaders/git/tests/loader.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ describe('GitLoader', () => {
116116
});
117117

118118
it('should throw when the file does not exist', async () => {
119-
await expect(load(getPointer('wrong-filename.graphql'), {})).rejects.toThrowError(
119+
await expect(load(getPointer('wrong-filename.graphql'), {})).rejects.toThrow(
120120
'Unable to load file from git',
121121
);
122122
});

packages/loaders/github/tests/schema-from-github.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ test('expect loadSync to handle 401 request errors gracefully', async () => {
112112
token: 'BAD_TOKEN',
113113
});
114114
};
115-
expect(result).toThrowError('Unable to download schema from github: Bad credentials');
115+
expect(result).toThrow('Unable to download schema from github: Bad credentials');
116116
});
117117

118118
describe('expect handleResponse to handle error messages gracefully', () => {
@@ -130,7 +130,7 @@ describe('expect handleResponse to handle error messages gracefully', () => {
130130
});
131131
};
132132

133-
expect(result).toThrowError(`Unable to download schema from github: ${expectedMessage}`);
133+
expect(result).toThrow(`Unable to download schema from github: ${expectedMessage}`);
134134
});
135135

136136
it('Should handle multiple error messages', () => {
@@ -159,7 +159,7 @@ describe('expect handleResponse to handle error messages gracefully', () => {
159159

160160
const expectedMessage = errorMessages.map(e => e.message).join(', ');
161161

162-
expect(result).toThrowError(`Unable to download schema from github: ${expectedMessage}`);
162+
expect(result).toThrow(`Unable to download schema from github: ${expectedMessage}`);
163163
});
164164

165165
it('Should handle 401 error codes', () => {
@@ -178,6 +178,6 @@ describe('expect handleResponse to handle error messages gracefully', () => {
178178
});
179179
};
180180

181-
expect(result).toThrowError('Unable to download schema from github: Bad credentials');
181+
expect(result).toThrow('Unable to download schema from github: Bad credentials');
182182
});
183183
});

packages/loaders/json-file/tests/loader.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe('JsonFileLoader', () => {
6363
});
6464

6565
it('should throw when the file content is malformed', async () => {
66-
await expect(load(getPointer('failing/malformed.json'), {})).rejects.toThrowError(
66+
await expect(load(getPointer('failing/malformed.json'), {})).rejects.toThrow(
6767
'Unable to read JSON file',
6868
);
6969
});

packages/loaders/module/tests/loader.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,21 @@ describe('ModuleLoader', () => {
5454
});
5555

5656
it('should throw error when using a bad pointer', async () => {
57-
await expect(load(getPointer('type-defs-named-export', 'tooMany#'))).rejects.toThrowError(
57+
await expect(load(getPointer('type-defs-named-export', 'tooMany#'))).rejects.toThrow(
5858
'Schema pointer should match',
5959
);
6060
});
6161

6262
it('should throw error when using a bad identifier', async () => {
63-
await expect(
64-
load(getPointer('type-defs-named-export', 'badIdentifier')),
65-
).rejects.toThrowError('Unable to load schema from module');
63+
await expect(load(getPointer('type-defs-named-export', 'badIdentifier'))).rejects.toThrow(
64+
'Unable to load schema from module',
65+
);
6666
});
6767

6868
it('should throw error when loaded object is not GraphQLSchema, DocumentNode or string', async () => {
69-
await expect(
70-
load(getPointer('type-defs-named-export', 'favoriteNumber')),
71-
).rejects.toThrowError('Imported object was not a string, DocumentNode or GraphQLSchema');
69+
await expect(load(getPointer('type-defs-named-export', 'favoriteNumber'))).rejects.toThrow(
70+
'Imported object was not a string, DocumentNode or GraphQLSchema',
71+
);
7272
});
7373
});
7474
});

packages/loaders/url/tests/url-loader-browser.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ describeIf(platform() !== 'win32')('[url-loader] webpack bundle compat', () => {
393393
expect(result).toStrictEqual(sentDatas.slice(0, 2));
394394

395395
// no uncaught errors should be reported (browsers raise errors when canceling requests)
396-
expect(pageerrorFn).not.toBeCalled();
396+
expect(pageerrorFn).not.toHaveBeenCalled();
397397
});
398398
testIf(!globalThis.Bun)('terminates stream correctly', async () => {
399399
const document = parse(/* GraphQL */ `

packages/merge/tests/merge-nodes.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ describe('Merge Nodes', () => {
276276
`);
277277
const mergedFn = () => mergeGraphQLNodes([...type1.definitions, ...type2.definitions]);
278278

279-
expect(mergedFn).toThrowError(
279+
expect(mergedFn).toThrow(
280280
'Unable to merge GraphQL type "A": Field "f1" already defined with a different type. Declared as "String", but you tried to override with "Int"',
281281
);
282282
});

packages/merge/tests/merge-typedefs.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ describe('Merge TypeDefs', () => {
11261126
}
11271127
`,
11281128
]);
1129-
}).toThrowError('Unable to merge GraphQL type');
1129+
}).toThrow('Unable to merge GraphQL type');
11301130
});
11311131

11321132
it('should preserve an extend keyword if there is no base', () => {

0 commit comments

Comments
 (0)