Skip to content

Commit 221d6c3

Browse files
authored
replace toThrowError with toThrow (#67)
1 parent a594613 commit 221d6c3

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/__tests__/ExpoClient-test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ describe('sending push notification messages', () => {
102102
(fetch as any).mock('https://exp.host/--/api/v2/push/send', { data: mockTickets });
103103

104104
const client = new ExpoClient();
105-
await expect(client.sendPushNotificationsAsync([{ to: 'a' }])).rejects.toThrowError(
105+
await expect(client.sendPushNotificationsAsync([{ to: 'a' }])).rejects.toThrow(
106106
`Expected Expo to respond with 1 ticket but got 2`,
107107
);
108108

109109
await expect(
110110
client.sendPushNotificationsAsync([{ to: 'a' }, { to: 'b' }, { to: 'c' }]),
111-
).rejects.toThrowError(`Expected Expo to respond with 3 tickets but got 2`);
111+
).rejects.toThrow(`Expected Expo to respond with 3 tickets but got 2`);
112112
});
113113

114114
test('handles 200 HTTP responses with well-formed API errors', async () => {
@@ -119,7 +119,7 @@ describe('sending push notification messages', () => {
119119

120120
const client = new ExpoClient();
121121
const rejection = expect(client.sendPushNotificationsAsync([])).rejects;
122-
await rejection.toThrowError(`This is a test error`);
122+
await rejection.toThrow(`This is a test error`);
123123
await rejection.toMatchObject({ code: 'TEST_API_ERROR' });
124124
});
125125

@@ -130,7 +130,7 @@ describe('sending push notification messages', () => {
130130
});
131131

132132
const client = new ExpoClient();
133-
await expect(client.sendPushNotificationsAsync([])).rejects.toThrowError(
133+
await expect(client.sendPushNotificationsAsync([])).rejects.toThrow(
134134
`Expo responded with an error`,
135135
);
136136
});
@@ -145,7 +145,7 @@ describe('sending push notification messages', () => {
145145

146146
const client = new ExpoClient();
147147
const rejection = expect(client.sendPushNotificationsAsync([])).rejects;
148-
await rejection.toThrowError(`This is a test error`);
148+
await rejection.toThrow(`This is a test error`);
149149
await rejection.toMatchObject({ code: 'TEST_API_ERROR' });
150150
});
151151

@@ -156,7 +156,7 @@ describe('sending push notification messages', () => {
156156
});
157157

158158
const client = new ExpoClient();
159-
await expect(client.sendPushNotificationsAsync([])).rejects.toThrowError(
159+
await expect(client.sendPushNotificationsAsync([])).rejects.toThrow(
160160
`Expo responded with an error`,
161161
);
162162
});
@@ -168,7 +168,7 @@ describe('sending push notification messages', () => {
168168
});
169169

170170
const client = new ExpoClient();
171-
await expect(client.sendPushNotificationsAsync([])).rejects.toThrowError(
171+
await expect(client.sendPushNotificationsAsync([])).rejects.toThrow(
172172
`Expo responded with an error`,
173173
);
174174
});
@@ -196,7 +196,7 @@ describe('sending push notification messages', () => {
196196

197197
const client = new ExpoClient();
198198
const rejection = expect(client.sendPushNotificationsAsync([])).rejects;
199-
await rejection.toThrowError(`This is a test error`);
199+
await rejection.toThrow(`This is a test error`);
200200
await rejection.toMatchObject({
201201
code: 'TEST_API_ERROR',
202202
details: { __debug: 'test debug information' },
@@ -221,7 +221,7 @@ describe('sending push notification messages', () => {
221221
const ticketPromise = client.sendPushNotificationsAsync([]);
222222

223223
const rejection = expect(ticketPromise).rejects;
224-
await rejection.toThrowError(`Rate limit exceeded`);
224+
await rejection.toThrow(`Rate limit exceeded`);
225225
await rejection.toMatchObject({ code: 'RATE_LIMIT_ERROR' });
226226

227227
expect((fetch as any).done()).toBeTruthy();
@@ -287,7 +287,7 @@ describe('retrieving push notification receipts', () => {
287287
const rejection = expect(
288288
client.getPushNotificationReceiptsAsync(['XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX']),
289289
).rejects;
290-
await rejection.toThrowError(`Expected Expo to respond with a map`);
290+
await rejection.toThrow(`Expected Expo to respond with a map`);
291291
await rejection.toMatchObject({ data: mockReceipts });
292292
});
293293
});

0 commit comments

Comments
 (0)