Skip to content

Commit dfac47a

Browse files
committed
test: replace outdated toThrowError with toThrow
1 parent 3db32a4 commit dfac47a

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

test/e2e/gelato-admin.spec.ts

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

5656
it('should throw when attempting to initialize a client with an invalid client name', async () => {
57-
expect(() => initializeClient(undefined, '')).toThrowError(GelatoClientError);
57+
expect(() => initializeClient(undefined, '')).toThrow(GelatoClientError);
5858
});
5959

6060
it('should throw when attempting to initialize a client with an invalid api key', async () => {
@@ -353,7 +353,7 @@ function initializeTestEnvironmentVariables() {
353353

354354
try {
355355
return loadEnvConfig();
356-
} catch (error) {
356+
} catch {
357357
throw new Error(
358358
`Error loading environment variables.
359359
To run the end-to-end tests, you need to create a .env file in the root directory of the project.

test/unit/client/lifecycle.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ describe('ClientStore', () => {
9898
ClientErrorMessage.DUBPLICATE_CLIENT_NAME.replace('{{clientName}}', mocks.clientName),
9999
);
100100

101-
expect(initializeClientCall).toThrowError(invalidClientNameError);
101+
expect(initializeClientCall).toThrow(invalidClientNameError);
102102
});
103103

104104
it(`should throw when neither 'option.apiKey' & ${GELATO_API_KEY_VAR} is available`, () => {
@@ -108,7 +108,7 @@ describe('ClientStore', () => {
108108
'mock-client-no-api-key-provided',
109109
);
110110

111-
expect(initializeClientCall).toThrowError(GelatoClientError);
111+
expect(initializeClientCall).toThrow(GelatoClientError);
112112
});
113113

114114
it('should throw when an empty apiKey is provided', () => {
@@ -132,21 +132,21 @@ describe('ClientStore', () => {
132132
describe('#getClient()', () => {
133133
it('should throw when provided clientName is not a non-empty string', () => {
134134
const expectedError = makeInvalidClientError(emptyClientName);
135-
expect(() => mockClientStore.getClient(emptyClientName)).toThrowError(expectedError);
135+
expect(() => mockClientStore.getClient(emptyClientName)).toThrow(expectedError);
136136
});
137137

138138
it('should throw when a client by clientName does not exist', () => {
139139
const nonExistingClientName = 'non-existing-client-name';
140140
const expectedErrorMessage = `Gelato client named "${nonExistingClientName}" does not exist. Make sure you call initializeClient() before using any of the Gelato API services.`;
141141
const expectedError = makeNoClientError(expectedErrorMessage);
142-
expect(() => mockClientStore.getClient(nonExistingClientName)).toThrowError(expectedError);
142+
expect(() => mockClientStore.getClient(nonExistingClientName)).toThrow(expectedError);
143143
});
144144

145145
it('should throw when the default clientName does not exist', () => {
146146
const expectedErrorMessage =
147147
'The default Gelato client does not exist. Make sure you call initializeClient() before using any of the Gelato API services.';
148148
const expectedError = makeNoClientError(expectedErrorMessage);
149-
expect(() => new ClientStore().getClient(DEFAULT_CLIENT_NAME)).toThrowError(expectedError);
149+
expect(() => new ClientStore().getClient(DEFAULT_CLIENT_NAME)).toThrow(expectedError);
150150
});
151151

152152
it('should return a client instance by given clientName', () => {

0 commit comments

Comments
 (0)