Skip to content

Commit

Permalink
Wrap functions who are used in a throw test (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderRedYT authored Jun 12, 2024
1 parent ac4db49 commit 633ff0f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions __tests__/errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('Test errors', () => {
kwp: 0,
});

await expect(instance.request('test')).rejects.toThrow(ForecastSolarRequestError);
await expect(() => instance.request('test')).rejects.toThrow(ForecastSolarRequestError);

expect(route).toHaveBeenCalledTimes(1);
});
Expand All @@ -69,7 +69,7 @@ describe('Test errors', () => {
kwp: 0,
});

await expect(instance.request('test')).rejects.toThrow(ForecastSolarAuthenticationError);
await expect(() => instance.request('test')).rejects.toThrow(ForecastSolarAuthenticationError);

expect(route).toHaveBeenCalledTimes(1);
});
Expand All @@ -94,7 +94,7 @@ describe('Test errors', () => {
kwp: 0,
});

await expect(instance.request('test')).rejects.toThrow(ForecastSolarConfigError);
await expect(() => instance.request('test')).rejects.toThrow(ForecastSolarConfigError);

expect(route).toHaveBeenCalledTimes(1);
});
Expand All @@ -119,7 +119,7 @@ describe('Test errors', () => {
kwp: 0,
});

await expect(instance.request('test')).rejects.toThrow(ForecastSolarRateLimitError);
await expect(() => instance.request('test')).rejects.toThrow(ForecastSolarRateLimitError);

expect(route).toHaveBeenCalledTimes(1);
});
Expand All @@ -144,7 +144,7 @@ describe('Test errors', () => {
kwp: 0,
});

await expect(instance.request('test')).rejects.toThrow(ForecastSolarConnectionError);
await expect(() => instance.request('test')).rejects.toThrow(ForecastSolarConnectionError);

expect(route).toHaveBeenCalledTimes(1);
});
Expand Down
4 changes: 2 additions & 2 deletions __tests__/models.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ describe('Test estimated forecast', () => {
baseEndpoint: url.toString(),
});

await expect(instance.estimate()).rejects.toThrowErrorMatchingSnapshot('invalid_data');
await expect(() => instance.estimate()).rejects.toThrowErrorMatchingSnapshot('invalid_data');

expect(route).toHaveBeenCalledTimes(1);
});
Expand All @@ -200,7 +200,7 @@ describe('Test estimated forecast', () => {
baseEndpoint: url.toString(),
});

await expect(instance.estimate()).rejects.toThrowErrorMatchingSnapshot('headers_missing');
await expect(() => instance.estimate()).rejects.toThrowErrorMatchingSnapshot('headers_missing');

expect(route).toHaveBeenCalledTimes(1);
});
Expand Down

0 comments on commit 633ff0f

Please # to comment.