tests: easysync: Inline some functions that are only used once
parent
e535129f3c
commit
4f283b64cf
|
@ -29,33 +29,21 @@ const AttributePool = require('../../../static/js/AttributePool');
|
|||
const randInt = (maxValue) => Math.floor(Math.random() * maxValue);
|
||||
|
||||
describe('easysync', function () {
|
||||
const throughIterator = (opsStr) => {
|
||||
const iter = Changeset.opIterator(opsStr);
|
||||
const assem = Changeset.opAssembler();
|
||||
while (iter.hasNext()) {
|
||||
assem.append(iter.next());
|
||||
}
|
||||
return assem.toString();
|
||||
};
|
||||
|
||||
const throughSmartAssembler = (opsStr) => {
|
||||
const iter = Changeset.opIterator(opsStr);
|
||||
const assem = Changeset.smartOpAssembler();
|
||||
while (iter.hasNext()) {
|
||||
assem.append(iter.next());
|
||||
}
|
||||
assem.endDocument();
|
||||
return assem.toString();
|
||||
};
|
||||
|
||||
it('throughIterator', async function () {
|
||||
const x = '-c*3*4+6|3=az*asdf0*1*2*3+1=1-1+1*0+1=1-1+1|c=c-1';
|
||||
expect(throughIterator(x)).to.equal(x);
|
||||
const iter = Changeset.opIterator(x);
|
||||
const assem = Changeset.opAssembler();
|
||||
while (iter.hasNext()) assem.append(iter.next());
|
||||
expect(assem.toString()).to.equal(x);
|
||||
});
|
||||
|
||||
it('throughSmartAssembler', async function () {
|
||||
const x = '-c*3*4+6|3=az*asdf0*1*2*3+1=1-1+1*0+1=1-1+1|c=c-1';
|
||||
expect(throughSmartAssembler(x)).to.equal(x);
|
||||
const iter = Changeset.opIterator(x);
|
||||
const assem = Changeset.smartOpAssembler();
|
||||
while (iter.hasNext()) assem.append(iter.next());
|
||||
assem.endDocument();
|
||||
expect(assem.toString()).to.equal(x);
|
||||
});
|
||||
|
||||
const applyMutations = (mu, arrayOfArrays) => {
|
||||
|
|
Loading…
Reference in New Issue