Skip to content

Commit

Permalink
test(#232): 순환 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
Conut-1 committed Dec 13, 2023
1 parent 9d1f94e commit aeed977
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions nestjs-BE/server/src/crdt/crdt-tree.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,18 @@ it('crdt tree 역직렬화', () => {

expect(JSON.stringify(tree)).toEqual(JSON.stringify(parsedTree));
});

it('crdt tree 순환', () => {
const tree = new CrdtTree<string>('1');

const op1 = tree.generateOperationAdd('a', 'root', 'hello');
const op2 = tree.generateOperationAdd('b', 'root', 'hi');
const op3 = tree.generateOperationAdd('c', 'a', 'good');
const op4 = tree.generateOperationAdd('d', 'b', 'bad');
const op5 = tree.generateOperationMove('a', 'b');
const op6 = tree.generateOperationMove('b', 'a');

tree.applyOperations([op1, op2, op3, op4, op5, op6]);

expect(tree.tree.get('b').parentId).toEqual('root');
});

0 comments on commit aeed977

Please sign in to comment.