mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-09-11 12:21:45 +02:00
feat(import): add stable per-resource source keys to the importer contract (#614)
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
e63a87718c
commit
81a2a5d955
@@ -24,6 +24,38 @@ describe("importer-yaak", () => {
|
||||
expect(result).toEqual(parseJsonOrYaml(expected));
|
||||
});
|
||||
}
|
||||
|
||||
test("Keys resources by their Insomnia _id, unchanged by a rename", () => {
|
||||
const collection = (requestName: string) =>
|
||||
YAML.stringify({
|
||||
type: "collection.insomnia.rest/5.0",
|
||||
name: "Keys",
|
||||
meta: { id: "wrk_1" },
|
||||
environments: { meta: { id: "env_1" }, name: "Base", data: {} },
|
||||
collection: [
|
||||
{
|
||||
meta: { id: "fld_1" },
|
||||
name: "Folder",
|
||||
children: [
|
||||
{
|
||||
meta: { id: "req_1" },
|
||||
name: requestName,
|
||||
method: "GET",
|
||||
url: "https://yaak.app",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const before = convertInsomnia(collection("Original"));
|
||||
const after = convertInsomnia(collection("Renamed"));
|
||||
|
||||
expect(before?.sourceKeys?.[before.resources.httpRequests[0]!.id]).toBe("req_1");
|
||||
expect(after?.sourceKeys?.[after.resources.httpRequests[0]!.id]).toBe("req_1");
|
||||
expect(before?.sourceKeys?.[before.resources.folders[0]!.id]).toBe("fld_1");
|
||||
expect(before?.sourceKeys?.[before.resources.workspaces[0]!.id]).toBe("wrk_1");
|
||||
});
|
||||
});
|
||||
|
||||
function parseJsonOrYaml(text: string): unknown {
|
||||
|
||||
Reference in New Issue
Block a user