import { serializedToDataset } from "../src/index.js"; import { turtleData, jsonLdData, turtleData2 } from "./sampleData.js"; describe("createExtendedDatasetFromSerializedInput", () => { it("creates a dataset with turtle", async () => { const dataset = await serializedToDataset(turtleData); expect(dataset.size).toBe(9); expect(dataset.toString()).toBe( '<#id1604448082795> "2020-11-04T00:01:22Z"^^ .\n<#id1604448082795> .\n<#id1604448082795> "#e1f7cd" .\n<#this> .\n<#this> .\n<#this> "2020-11-04T00:01:20Z"^^ .\n<#this> "Chat channel" .\n<#this> <#id1604448082795> .\n<#this> <#SharedPreferences> .\n', ); }); it.skip("creates a dataset with json-ld", async () => { const dataset = await serializedToDataset(JSON.stringify(jsonLdData), { format: "application/ld+json", }); expect(dataset.size).toBe(9); }); it("Should create a dataset with some more turtle", async () => { const dataset = await serializedToDataset(turtleData2); expect(dataset.toString()).toBe( ' "Robert" .\n "Taylor" .\n "Johnson" .\n "2020-11-04T00:01:22Z" .\n .\n', ); }); it.skip("Should error when given invalid JSON", async () => { await expect( serializedToDataset('{ bad" json', { format: "application/ld+json" }), ).rejects.toThrow("Unexpected token b in JSON at position 2"); }); });