feat: release authentication laboratories 0.3.0
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
exportGoogleMigration,
|
||||
exportCsv,
|
||||
importCsv,
|
||||
importGoogleMigrationBatch,
|
||||
@@ -115,4 +116,27 @@ describe("OTP migrations", () => {
|
||||
importGoogleMigrationBatch([googlePart(0), googlePart(1, 2, 99)]),
|
||||
).toThrow(/different batches/iu);
|
||||
});
|
||||
|
||||
it("exports and reassembles Google migration batches", () => {
|
||||
const portable = { ...profile, period: 30 };
|
||||
const exported = exportGoogleMigration(
|
||||
[portable, { ...portable, account: "bob" }],
|
||||
1,
|
||||
);
|
||||
expect(exported.uris).toHaveLength(2);
|
||||
const imported = importGoogleMigrationBatch(exported.uris);
|
||||
expect(imported.profiles.map(({ account }) => account)).toEqual([
|
||||
profile.account,
|
||||
"bob",
|
||||
]);
|
||||
expect(imported.profiles[0]).toMatchObject({
|
||||
algorithm: "SHA-256",
|
||||
digits: 8,
|
||||
period: 30,
|
||||
});
|
||||
});
|
||||
|
||||
it("refuses lossy Google exports", () => {
|
||||
expect(() => exportGoogleMigration([profile])).toThrow(/period or epoch/u);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user