Skip to content

Commit a2c7979

Browse files
webzwo0irhansen
authored andcommitted
easysync tests: add some more smartOpAssembler tests
1 parent 10c55a2 commit a2c7979

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/tests/frontend/specs/easysync-assembler.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,40 @@ describe('easysync-assembler', function () {
9292
expect(assem.toString()).to.equal('-k');
9393
});
9494

95+
it('smartOpAssembler append - op with text', async function () {
96+
const assem = Changeset.smartOpAssembler();
97+
const pool = poolOrArray([
98+
'attr1,1',
99+
'attr2,2',
100+
'attr3,3',
101+
'attr4,4',
102+
'attr5,5',
103+
]);
104+
105+
assem.appendOpWithText('-', 'test', '*3*4*5', pool);
106+
assem.appendOpWithText('-', 'test', '*3*4*5', pool);
107+
assem.appendOpWithText('-', 'test', '*1*4*5', pool);
108+
assem.endDocument();
109+
expect(assem.toString()).to.equal('*3*4*5-8*1*4*5-4');
110+
});
111+
112+
it('smartOpAssembler append - op with multiline text', async function () {
113+
const assem = Changeset.smartOpAssembler();
114+
const pool = poolOrArray([
115+
'attr1,1',
116+
'attr2,2',
117+
'attr3,3',
118+
'attr4,4',
119+
'attr5,5',
120+
]);
121+
122+
assem.appendOpWithText('-', 'test\ntest', '*3*4*5', pool);
123+
assem.appendOpWithText('-', '\ntest\n', '*3*4*5', pool);
124+
assem.appendOpWithText('-', '\ntest', '*1*4*5', pool);
125+
assem.endDocument();
126+
expect(assem.toString()).to.equal('*3*4*5|3-f*1*4*5|1-1*1*4*5-4');
127+
});
128+
95129
it('smartOpAssembler append + op with text', async function () {
96130
const assem = Changeset.smartOpAssembler();
97131
const pool = poolOrArray([

0 commit comments

Comments
 (0)