Skip to content

Commit

Permalink
test: only 1
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelcr committed Aug 9, 2024
1 parent 0999655 commit c751596
Showing 1 changed file with 42 additions and 42 deletions.
84 changes: 42 additions & 42 deletions tests/token-queue/image-cache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,52 +37,52 @@ describe('Image cache', () => {
}
});

test('throws rate limit error', async () => {
console.log('A');
const server = createTestResponseServer('rate limit exceeded', 429);
const serverReady = waiter();
server.listen(9999, 'localhost', () => serverReady.finish());
await serverReady;
console.log('B');
// test('throws rate limit error', async () => {
// console.log('A');
// const server = createTestResponseServer('rate limit exceeded', 429);
// const serverReady = waiter();
// server.listen(9999, 'localhost', () => serverReady.finish());
// await serverReady;
// console.log('B');

try {
console.log('C');
await expect(
processImageCache('http://localhost:9999/', contract, tokenNumber)
).rejects.toThrow(TooManyRequestsHttpError);
console.log('D');
} finally {
console.log('E');
const serverDone = waiter();
server.close(() => serverDone.finish());
await serverDone;
console.log('F');
}
});
// try {
// console.log('C');
// await expect(
// processImageCache('http://localhost:9999/', contract, tokenNumber)
// ).rejects.toThrow(TooManyRequestsHttpError);
// console.log('D');
// } finally {
// console.log('E');
// const serverDone = waiter();
// server.close(() => serverDone.finish());
// await serverDone;
// console.log('F');
// }
// });

test('throws other server errors', async () => {
const server = createTestResponseServer('not found', 404);
const serverReady = waiter();
server.listen(9999, 'localhost', () => serverReady.finish());
await serverReady;
// test('throws other server errors', async () => {
// const server = createTestResponseServer('not found', 404);
// const serverReady = waiter();
// server.listen(9999, 'localhost', () => serverReady.finish());
// await serverReady;

try {
await expect(
processImageCache('http://localhost:9999/', contract, tokenNumber)
).rejects.toThrow(HttpError);
} finally {
const serverDone = waiter();
server.close(() => serverDone.finish());
await serverDone;
}
});
// try {
// await expect(
// processImageCache('http://localhost:9999/', contract, tokenNumber)
// ).rejects.toThrow(HttpError);
// } finally {
// const serverDone = waiter();
// server.close(() => serverDone.finish());
// await serverDone;
// }
// });

test('ignores data: URL', async () => {
const url = 'data:123456';
await expect(processImageCache(url, contract, tokenNumber)).resolves.toStrictEqual([
'data:123456',
]);
});
// test('ignores data: URL', async () => {
// const url = 'data:123456';
// await expect(processImageCache(url, contract, tokenNumber)).resolves.toStrictEqual([
// 'data:123456',
// ]);
// });

// test('throws upload error', async () => {
// const server = createTestResponseServer('success');
Expand Down

0 comments on commit c751596

Please sign in to comment.