|
@@ -23,10 +23,10 @@ describe("Delta", () => {
|
|
|
const creation = new NodeCreation(getId());
|
|
|
assert(creation.getConflicts().length === 0, "did not expect node creation to be conflicting with any other operation");
|
|
|
|
|
|
- const deletion1 = new NodeDeletion(creation, []);
|
|
|
+ const deletion1 = new NodeDeletion(creation, [], []);
|
|
|
assert(deletion1.getConflicts().length === 0, "did not expect first deletion alone to be conflicting with anything");
|
|
|
|
|
|
- const deletion2 = new NodeDeletion(creation, []);
|
|
|
+ const deletion2 = new NodeDeletion(creation, [], []);
|
|
|
assert(deletion1.getConflicts().length === 1, "expected second deletion to be conflicting with first deletion");
|
|
|
assert(deletion2.getConflicts().length === 1, "expected second deletion to be conflicting with first deletion");
|
|
|
|
|
@@ -73,7 +73,7 @@ describe("Delta", () => {
|
|
|
const sourceCreation = new NodeCreation(getId());
|
|
|
const targetCreation = new NodeCreation(getId());
|
|
|
|
|
|
- const sourceDeletion = new NodeDeletion(sourceCreation, []);
|
|
|
+ const sourceDeletion = new NodeDeletion(sourceCreation, [], []);
|
|
|
assert(sourceDeletion.getConflicts().length === 0, "expected no conflicts so far");
|
|
|
|
|
|
const edgeCreation = new EdgeCreation(sourceCreation, "label", targetCreation);
|
|
@@ -91,7 +91,7 @@ describe("Delta", () => {
|
|
|
const edgeCreation = new EdgeCreation(sourceCreation, "label", targetCreation);
|
|
|
assert(edgeCreation.getConflicts().length === 0, "expected no conflicts so far");
|
|
|
|
|
|
- const sourceDeletion = new NodeDeletion(sourceCreation, []);
|
|
|
+ const sourceDeletion = new NodeDeletion(sourceCreation, [], []);
|
|
|
assert(edgeCreation.getConflicts().length === 1, "expected require/delete conflict, because edge source is concurrently deleted");
|
|
|
assert(sourceDeletion.getConflicts().length === 1, "expected require/delete conflict, because edge source is concurrently deleted");
|
|
|
});
|
|
@@ -105,7 +105,7 @@ describe("Delta", () => {
|
|
|
|
|
|
const edgeCreation = new EdgeCreation(sourceCreation, "label", targetCreation);
|
|
|
|
|
|
- const sourceDeletion = new NodeDeletion(sourceCreation, [edgeCreation]);
|
|
|
+ const sourceDeletion = new NodeDeletion(sourceCreation, [edgeCreation], []);
|
|
|
assert(sourceDeletion.getConflicts().length === 0, "Since deletion was aware of the edge creation, there should be no conflict");
|
|
|
});
|
|
|
|
|
@@ -122,7 +122,7 @@ describe("Delta", () => {
|
|
|
|
|
|
// no conflicts so far
|
|
|
|
|
|
- const sourceDeletion = new NodeDeletion(sourceCreation, []);
|
|
|
+ const sourceDeletion = new NodeDeletion(sourceCreation, [], []);
|
|
|
|
|
|
assert(edgeCreation.getConflicts().length === 1, "expected require/delete conflict, because edge source is concurrently deleted");
|
|
|
assert(sourceDeletion.getConflicts().length === 1, "expected require/delete conflict, because edge source is concurrently deleted");
|
|
@@ -137,7 +137,7 @@ describe("Delta", () => {
|
|
|
const sourceCreation = new NodeCreation(getId());
|
|
|
const targetCreation = new NodeCreation(getId());
|
|
|
const edgeCreation = new EdgeCreation(sourceCreation, "label", targetCreation);
|
|
|
- const sourceDeletion = new NodeDeletion(sourceCreation, [edgeCreation]);
|
|
|
+ const sourceDeletion = new NodeDeletion(sourceCreation, [edgeCreation], []);
|
|
|
|
|
|
// no conflicts so far
|
|
|
|
|
@@ -153,7 +153,7 @@ describe("Delta", () => {
|
|
|
const sourceCreation = new NodeCreation(getId());
|
|
|
const targetCreation = new NodeCreation(getId());
|
|
|
|
|
|
- const targetDeletion = new NodeDeletion(targetCreation, []);
|
|
|
+ const targetDeletion = new NodeDeletion(targetCreation, [], []);
|
|
|
|
|
|
const edgeCreation = new EdgeCreation(sourceCreation, "label", targetCreation);
|
|
|
assert(edgeCreation.getConflicts().length === 1, "expected require/delete conflict");
|
|
@@ -168,7 +168,7 @@ describe("Delta", () => {
|
|
|
const edgeCreation = new EdgeCreation(sourceCreation, "label", targetCreation);
|
|
|
|
|
|
// delete target of edge, unaware that edge exists:
|
|
|
- const targetDeletion = new NodeDeletion(targetCreation, []);
|
|
|
+ const targetDeletion = new NodeDeletion(targetCreation, [], []);
|
|
|
|
|
|
assert(edgeCreation.getConflicts().length === 1, "expected require/delete conflict");
|
|
|
assert(targetDeletion.getConflicts().length === 1, "expected require/delete conflict");
|
|
@@ -183,28 +183,37 @@ describe("Delta", () => {
|
|
|
const edgeUpdate = new EdgeUpdate(edgeCreation, sourceCreation); // turn edge into self-edge
|
|
|
|
|
|
// because of the edgeUpdate, 'target' is no longer the target of the edge, and can be deleted:
|
|
|
- const targetDeletion = new NodeDeletion(targetCreation, [edgeUpdate]);
|
|
|
+ const targetDeletion = new NodeDeletion(targetCreation, [], [edgeUpdate]);
|
|
|
|
|
|
console.log(edgeCreation.getConflicts())
|
|
|
assert(edgeCreation.getConflicts().length === 0, "expected no require/delete conflict");
|
|
|
assert(targetDeletion.getConflicts().length === 0, "expected no require/delete conflict");
|
|
|
});
|
|
|
|
|
|
-
|
|
|
- // Not yet supported
|
|
|
it("Delete source and target of edge (no conflict)", () => {
|
|
|
const getId = mockUuid();
|
|
|
|
|
|
const sourceCreation = new NodeCreation(getId());
|
|
|
const targetCreation = new NodeCreation(getId());
|
|
|
const edgeCreation = new EdgeCreation(sourceCreation, "label", targetCreation);
|
|
|
- const sourceDeletion = new NodeDeletion(sourceCreation, [edgeCreation]);
|
|
|
+ const sourceDeletion = new NodeDeletion(sourceCreation, [edgeCreation], []);
|
|
|
|
|
|
assert(sourceDeletion.getConflicts().length === 0, "expected no conflicts");
|
|
|
|
|
|
- const targetDeletion = new NodeDeletion(targetCreation, [sourceDeletion]); // unsupported :(
|
|
|
+ const targetDeletion = new NodeDeletion(targetCreation, [], [sourceDeletion]);
|
|
|
|
|
|
assert(targetDeletion.getConflicts().length === 0, "expected no conflicts");
|
|
|
- })
|
|
|
+ });
|
|
|
|
|
|
+ it("Delete node with self-edge", () => {
|
|
|
+ const getId = mockUuid();
|
|
|
+
|
|
|
+ const nodeCreation = new NodeCreation(getId());
|
|
|
+ const edgeCreation = new EdgeCreation(nodeCreation, "label", nodeCreation);
|
|
|
+ const edgeUpdate = new EdgeUpdate(edgeCreation, null);
|
|
|
+ const nodeDeletion = new NodeDeletion(nodeCreation, [edgeUpdate], [edgeUpdate]);
|
|
|
+
|
|
|
+ console.log(nodeDeletion.getConflicts());
|
|
|
+ assert(nodeDeletion.getConflicts().length === 0, "expected no conflicts");
|
|
|
+ })
|
|
|
});
|