Skip to content

Commit

Permalink
Added test functionality to compare against
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaAtulTewari committed Jul 24, 2024
1 parent e7cd9f4 commit cdd9405
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/workerd/api/http-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,45 @@ export const inspect = {
await messagePromise;
}
};

export const cacheMode = {
async test() {
assert.strictEqual("cache" in Request.prototype, false);
{
const req = new Request('https://example.org', { });
assert.strictEqual(req.cache, undefined);
}
{
assert.throws(() => {
new Request('https://example.org', { cache: 'no-store' });
}, {
name: 'Error',
message: "The 'cache' field on 'RequestInitializerDict' is not implemented.",
});
}
{
assert.throws(() => {
new Request('https://example.org', { cache: 'no-cache' });
}, {
name: 'Error',
message: "The 'cache' field on 'RequestInitializerDict' is not implemented.",
});
}
{
assert.throws(() => {
new Request('https://example.org', { cache: 'unsupported' });
}, {
name: 'Error',
message: "The 'cache' field on 'RequestInitializerDict' is not implemented.",
});
}
{
await assert.rejects((async () => {
await fetch('http://example.org', { cache: 'no-transform' });
})(), {
name: 'Error',
message: "The 'cache' field on 'RequestInitializerDict' is not implemented.",
});
}
}
}

0 comments on commit cdd9405

Please sign in to comment.