Skip to content

Commit

Permalink
enable and improve three-way merge unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sdumetz committed Jan 8, 2024
1 parent 93e6a91 commit 9faebb3
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions source/server/utils/merge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ describe("three-way merge", function(){
});
})

describe.skip("by name", function(){
describe("by name", function(){

it("reassign scene nodes appropriately", function(){
//Differentiate nodes by their names
Expand All @@ -185,7 +185,24 @@ describe("three-way merge", function(){
});

it("reassign nodes children appropriately", function(){

const common = [
{name: "Parent", children: [1,2]},
{name: "Child 1"},
{name: "Child 2"},
]
const parent2 = { "name": "Parent 2"};
const child3 = { "name": "Child 3"};
const ref = {nodes: common, scenes:[{nodes:[0]}] };
const current = {nodes: [...common, parent2], scenes:[{nodes:[0, 3]}]};
const next = {nodes: [{name:"Parent", children:[1,2,3] }, ...common.slice(1), child3], scenes:[{nodes:[0]}]};

expect(apply(current, diff(ref, next))).to.deep.equal({nodes: [
{name:"Parent", children:[1,2,4] },
common[1],
common[2],
parent2,
child3,
], scenes:[{nodes:[0, 3]}]});
});

["lights", "cameras", "models"].forEach(type=>{
Expand Down

0 comments on commit 9faebb3

Please sign in to comment.