You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
940 B
28 lines
940 B
import { describe, expect, it } from "vitest";
|
|
import { qqDnaEmailPool } from "@/lib/flock/qqdna-email-pool";
|
|
import { createFreshFlockTestAccount } from "@/lib/flock/fresh-account";
|
|
|
|
describe("qqDnaEmailPool", () => {
|
|
it("全部为合法长度 QQ@qq.com", () => {
|
|
const pool = qqDnaEmailPool();
|
|
expect(pool.length).toBeGreaterThan(50);
|
|
for (const email of pool) {
|
|
expect(email).toMatch(/^\d{5,11}@qq\.com$/);
|
|
}
|
|
});
|
|
});
|
|
|
|
describe("FLOCK_EMAIL_MODE=qqdna", () => {
|
|
it("轮询取 qqdna 池", () => {
|
|
const prev = process.env.FLOCK_EMAIL_MODE;
|
|
process.env.FLOCK_EMAIL_MODE = "qqdna";
|
|
delete process.env.FLOCK_EMAIL_POOL;
|
|
const a = createFreshFlockTestAccount();
|
|
const b = createFreshFlockTestAccount();
|
|
expect(a.email).toMatch(/^\d{5,11}@qq\.com$/);
|
|
expect(b.email).toMatch(/^\d{5,11}@qq\.com$/);
|
|
expect(a.email).not.toBe(b.email);
|
|
process.env.FLOCK_EMAIL_MODE = prev;
|
|
});
|
|
});
|