Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/lock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ describe("simple use", () => {
await using _ = await request();
const lock2Wait = request({ signal });
controller.abort();
await expect(lock2Wait).rejects.toThrow("This operation was aborted");
await expect(lock2Wait).rejects.toThrow(new DOMException("This operation was aborted", "AbortError"));
}
});
}
Expand Down Expand Up @@ -206,6 +206,19 @@ describe("simple use", () => {
}
});
}
{
const name = "steal:true and ifAvailable:true";
test.concurrent("steal:true and ifAvailable:true", async ({ expect }) => {
const { request } = lock(name);
{
const lockWait = request({
ifAvailable: true,
steal: true,
});
expect(lockWait).rejects.toThrow(new DOMException("ifAvailable and steal are mutually exclusive", "NotSupportedError"));
}
});
}
});
describe("hard error pattern", () => {
const name = "not found navigator.locks";
Expand All @@ -216,7 +229,7 @@ describe("hard error pattern", () => {
value: undefined,
});
try {
expect(() => lock(name)).toThrow("navigator.locks is not found. required options.locks argument.");
expect(() => lock(name)).toThrow(new Error("navigator.locks is not found. required options.locks argument."));

const { request, query } = lock(name, { locks });
{
Expand Down
Loading