Skip to content

Commit

Permalink
test: 💍 improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
touv committed Jan 6, 2025
1 parent 7833ca4 commit 807a956
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions packages/basics/test/url-fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ httpbin
.post('/status/503')
.reply(503);

httpbin
.get('/status/503')
.reply(503);

httpbin
.post('/status/404')
.reply(404);
Expand Down Expand Up @@ -205,6 +209,40 @@ describe('URLFetch', () => {
done(new Error('Error is the right behavior'));
});
});
test('#6', (done) => {
ezs.use(statements);
const input = [
{ a: 'a' },
{ a: 'b' },
{ a: 'c' },
];
const script = `
[URLFetch]
url = get('a').replace(/(.*)/, 'https://httpbin.org/status/503')
json = true
retries = 2
timeout = 10
[exchange]
value = get('args')
`;
from(input)
.pipe(ezs('delegate', { script }))
.pipe(ezs.catch())
.on('error', (e) => {
try {
expect(e.message).toEqual(expect.stringContaining('Service Unavailable'));

} catch(ee) {
return done(ee);
}
return done();
})
.on('end', () => {
done(new Error('Error is the right behavior'));
});
});

test('#3bis', (done) => {
ezs.use(statements);
const input = [
Expand Down

0 comments on commit 807a956

Please sign in to comment.