Skip to content

Commit

Permalink
test: adds unit test for utensils
Browse files Browse the repository at this point in the history
(they were already covered in an integration test, but having it explicitly in a UT is useful
  • Loading branch information
sverweij committed Oct 1, 2023
1 parent d4dd08d commit 95ad4ab
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/utensils.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { equal } from "node:assert/strict";
import { describe, it } from "node:test";
import { isEmailIshUsername } from "./utensils";

describe("utensils - isEmailIshUsername", () => {
it("should return true for email-like usernames", () => {
equal(isEmailIshUsername("[email protected]"), true);
equal(isEmailIshUsername("[email protected]"), true);
equal(isEmailIshUsername("[email protected]"), true);
});

it("should return false for non-email-like usernames", () => {
equal(isEmailIshUsername("john"), false);
equal(isEmailIshUsername("jane.doe"), false);
equal(isEmailIshUsername("jane.doe+test"), false);
equal(isEmailIshUsername("john@"), false);
equal(isEmailIshUsername("@example.com"), false);
});
});

0 comments on commit 95ad4ab

Please sign in to comment.