tests: Disable deprecation warnings when testing deprecated functions

pull/5345/head
Richard Hansen 2021-12-31 22:12:08 -05:00
parent c0471dd238
commit 6495b1e6f4
1 changed files with 17 additions and 6 deletions

View File

@ -1,6 +1,7 @@
'use strict';
const Changeset = require('../../../static/js/Changeset');
const {padutils} = require('../../../static/js/pad_utils');
const {poolOrArray} = require('../easysync-helper.js');
describe('easysync-assembler', function () {
@ -101,9 +102,14 @@ describe('easysync-assembler', function () {
'attr5,5',
]);
assem.appendOpWithText('+', 'test', '*3*4*5', pool);
assem.appendOpWithText('+', 'test', '*3*4*5', pool);
assem.appendOpWithText('+', 'test', '*1*4*5', pool);
padutils.warnDeprecated.disabledForTestingOnly = true;
try {
assem.appendOpWithText('+', 'test', '*3*4*5', pool);
assem.appendOpWithText('+', 'test', '*3*4*5', pool);
assem.appendOpWithText('+', 'test', '*1*4*5', pool);
} finally {
delete padutils.warnDeprecated.disabledForTestingOnly;
}
assem.endDocument();
expect(assem.toString()).to.equal('*3*4*5+8*1*4*5+4');
});
@ -118,9 +124,14 @@ describe('easysync-assembler', function () {
'attr5,5',
]);
assem.appendOpWithText('+', 'test\ntest', '*3*4*5', pool);
assem.appendOpWithText('+', '\ntest\n', '*3*4*5', pool);
assem.appendOpWithText('+', '\ntest', '*1*4*5', pool);
padutils.warnDeprecated.disabledForTestingOnly = true;
try {
assem.appendOpWithText('+', 'test\ntest', '*3*4*5', pool);
assem.appendOpWithText('+', '\ntest\n', '*3*4*5', pool);
assem.appendOpWithText('+', '\ntest', '*1*4*5', pool);
} finally {
delete padutils.warnDeprecated.disabledForTestingOnly;
}
assem.endDocument();
expect(assem.toString()).to.equal('*3*4*5|3+f*1*4*5|1+1*1*4*5+4');
});