Invite people after review, then finish the Rule, with login before inviting and Invite your members on Profile.
This commit is contained in:
1 parent
88bfccd1e7
commit
70ceb73104
31 files changed
+1388
-401
No files matched your search
@@ -0,0 +1,54 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
formatInviteCountWord,
|
||||
parseInvitePaste,
|
||||
splitInvitePasteTokens,
|
||||
} from "../../lib/create/parseInviteEmails";
|
||||
|
||||
describe("parseInviteEmails", () => {
|
||||
it("splits comma, semicolon, and whitespace lists", () => {
|
||||
expect(
|
||||
splitInvitePasteTokens("rosa@example.org, dev@example.org; sam@example.org\nlee@example.org"),
|
||||
).toEqual([
|
||||
"rosa@example.org",
|
||||
"dev@example.org",
|
||||
"sam@example.org",
|
||||
"lee@example.org",
|
||||
]);
|
||||
});
|
||||
|
||||
it("adds valid addresses and leaves invalid tokens in the remainder", () => {
|
||||
const result = parseInvitePaste(
|
||||
"rosa@example.org, jo@example, sam@example.org",
|
||||
["maya@example.org"],
|
||||
30,
|
||||
);
|
||||
expect(result.added).toEqual(["rosa@example.org", "sam@example.org"]);
|
||||
expect(result.invalidRemainder).toBe("jo@example");
|
||||
});
|
||||
|
||||
it("skips duplicates already on the list", () => {
|
||||
const result = parseInvitePaste(
|
||||
"maya@example.org, rosa@example.org",
|
||||
["maya@example.org"],
|
||||
30,
|
||||
);
|
||||
expect(result.added).toEqual(["rosa@example.org"]);
|
||||
expect(result.skippedDuplicate).toBe(1);
|
||||
});
|
||||
|
||||
it("keeps overflow addresses in the remainder once the max is hit", () => {
|
||||
const result = parseInvitePaste(
|
||||
"a@example.org, b@example.org, c@example.org",
|
||||
[],
|
||||
2,
|
||||
);
|
||||
expect(result.added).toEqual(["a@example.org", "b@example.org"]);
|
||||
expect(result.invalidRemainder).toBe("c@example.org");
|
||||
});
|
||||
|
||||
it("uses words for counts through ten", () => {
|
||||
expect(formatInviteCountWord(5)).toBe("five");
|
||||
expect(formatInviteCountWord(11)).toBe("11");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user