Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
e-moran committed Jan 10, 2025
1 parent f92d0e5 commit 598d567
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions arcjet/test/arcjet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,45 @@ describe("Primitive > validateEmail", () => {
);
});

test("validates `deny` and `block` cannot be set at the same time", async () => {
expect(() => {
validateEmail({
// @ts-expect-error
deny: ["FOOBAR"],
// @ts-expect-error
block: ["FOOBAR"],
});
}).toThrow(
"`validateEmail` options error: `deny` and `block` cannot be provided together, `block` is now deprecated so `deny` should be preferred.",
);
});

test("validates `allow` and `deny` cannot be set at the same time", async () => {
expect(() => {
validateEmail({
// @ts-expect-error
allow: ["FOOBAR"],
// @ts-expect-error
deny: ["FOOBAR"],
});
}).toThrow(
"`validateEmail` options error: `allow` and `deny` cannot be provided together",
);
});

test("validates `block` and `deny` cannot be set at the same time", async () => {
expect(() => {
validateEmail({
// @ts-expect-error
allow: ["FOOBAR"],
// @ts-expect-error
block: ["FOOBAR"],
});
}).toThrow(
"`validateEmail` options error: `allow` and `block` cannot be provided together",
);
});

test("validates `requireTopLevelDomain` option if it is set", async () => {
expect(() => {
validateEmail({
Expand Down

0 comments on commit 598d567

Please sign in to comment.