mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-08-24 07:12:18 +10:00
v5.2.0: undo/redo, version history, embedded AI assistant, mobile builder & more (#3205)
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { detectJsonImportType } from "./import";
|
||||
|
||||
describe("detectJsonImportType", () => {
|
||||
it("detects JSON Resume by a top-level basics without Reactive Resume sections/metadata", () => {
|
||||
expect(detectJsonImportType({ basics: { name: "A" }, work: [] })).toBe("json-resume-json");
|
||||
});
|
||||
|
||||
it("detects the current Reactive Resume schema by metadata.page", () => {
|
||||
expect(detectJsonImportType({ basics: {}, sections: {}, metadata: { page: { locale: "en-US" } } })).toBe(
|
||||
"reactive-resume-json",
|
||||
);
|
||||
});
|
||||
|
||||
it("detects the legacy v4 schema by metadata without a page key", () => {
|
||||
expect(detectJsonImportType({ basics: {}, sections: {}, metadata: { template: "azurill" } })).toBe(
|
||||
"reactive-resume-v4-json",
|
||||
);
|
||||
});
|
||||
|
||||
it("returns an empty string for unrecognized shapes", () => {
|
||||
expect(detectJsonImportType({ foo: "bar" })).toBe("");
|
||||
expect(detectJsonImportType(null)).toBe("");
|
||||
expect(detectJsonImportType("nope")).toBe("");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user