chore: format to 2-space and bump changelog
This commit is contained in:
@@ -2,28 +2,28 @@ import { describe, expect, it } from "vitest";
|
||||
import { assertProvider, normalizeE164, toWhatsappJid } from "./index.js";
|
||||
|
||||
describe("normalizeE164", () => {
|
||||
it("strips whatsapp prefix and whitespace", () => {
|
||||
expect(normalizeE164("whatsapp:+1 555 123 4567")).toBe("+15551234567");
|
||||
});
|
||||
it("strips whatsapp prefix and whitespace", () => {
|
||||
expect(normalizeE164("whatsapp:+1 555 123 4567")).toBe("+15551234567");
|
||||
});
|
||||
|
||||
it("adds plus when missing", () => {
|
||||
expect(normalizeE164("1555123")).toBe("+1555123");
|
||||
});
|
||||
it("adds plus when missing", () => {
|
||||
expect(normalizeE164("1555123")).toBe("+1555123");
|
||||
});
|
||||
});
|
||||
|
||||
describe("toWhatsappJid", () => {
|
||||
it("converts E164 to jid", () => {
|
||||
expect(toWhatsappJid("+1 555 123 4567")).toBe("15551234567@s.whatsapp.net");
|
||||
});
|
||||
it("converts E164 to jid", () => {
|
||||
expect(toWhatsappJid("+1 555 123 4567")).toBe("15551234567@s.whatsapp.net");
|
||||
});
|
||||
});
|
||||
|
||||
describe("assertProvider", () => {
|
||||
it("accepts valid providers", () => {
|
||||
expect(() => assertProvider("twilio")).not.toThrow();
|
||||
expect(() => assertProvider("web")).not.toThrow();
|
||||
});
|
||||
it("accepts valid providers", () => {
|
||||
expect(() => assertProvider("twilio")).not.toThrow();
|
||||
expect(() => assertProvider("web")).not.toThrow();
|
||||
});
|
||||
|
||||
it("throws on invalid provider", () => {
|
||||
expect(() => assertProvider("invalid" as string)).toThrow();
|
||||
});
|
||||
it("throws on invalid provider", () => {
|
||||
expect(() => assertProvider("invalid" as string)).toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user