Skip to content

Commit

Permalink
test: setThing should create blank nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximvdw committed Mar 26, 2022
1 parent 5832ac9 commit d2227cf
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/thing/thing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ describe("getThingAll", () => {
describe("setThing", () => {
const mockThing1Iri = "https://some.vocab/subject1";
const mockThing2Iri = "https://some.vocab/subject2";
const mockThing3Iri = "https://some.vocab/subject3";
const mockThing1: ThingPersisted = {
type: "Subject",
url: mockThing1Iri,
Expand All @@ -425,6 +426,22 @@ describe("setThing", () => {
},
},
};
const mockThing3: ThingPersisted = {
type: "Subject",
url: mockThing3Iri,
predicates: {
["https://arbitrary.vocab/predicate"]: {
namedNodes: ["https://arbitrary.vocab/object"],
blankNodes: [
{
["https://arbitrary.vocab/blanknode/predicate"]: {
namedNodes: ["https://arbitrary.vocab/blanknode/object"],
},
},
],
},
},
};
function getMockDataset(things = [mockThing1, mockThing2]): SolidDataset {
const solidDataset: SolidDataset = {
type: "Dataset",
Expand Down Expand Up @@ -576,6 +593,12 @@ describe("setThing", () => {
getThing(updatedDataset, "https://some.pod/resource#subjectName")
).toStrictEqual(originalThing);
});

it("will create blank nodes including in a Thing", () => {
const dataset = getMockDataset([]);
const updatedDataset = setThing(dataset, mockThing3);
expect(updatedDataset.internal_changeLog.additions).not.toHaveLength(1);
});
});

describe("removeThing", () => {
Expand Down

0 comments on commit d2227cf

Please sign in to comment.