fix tests

This commit is contained in:
Audric Ackermann 2021-04-23 09:29:53 +10:00
parent fa22edb1fb
commit 70572e1315
No known key found for this signature in database
GPG key ID: 999F434D76324AD4
2 changed files with 6 additions and 13 deletions

View file

@ -10,19 +10,16 @@ describe('Privacy', () => {
describe('redactSessionID', () => {
it('should redact all session IDs', () => {
const text =
'This is a log line with a session ID 0531032fc7415b7cc1b7516480ad121d391eddce3cfb2cee27dd5b215609c32827\n' +
'and another one 05766049a70e725ad02f7fe61b10e461380a4d7433f98096b3cacbf0362d5cab62';
'This is a log line with a session ID 0531032fc7415b7cc1b7516480ad121d391eddce3cfb2cee27dd5b215609c32827 and another one 05766049a70e725ad02f7fe61b10e461380a4d7433f98096b3cacbf0362d5cab62';
const actual = Privacy.redactSessionID(text);
const expected =
'This is a log line with a session ID [REDACTED]\n and another one [REDACTED]';
const expected = 'This is a log line with a session ID [REDACTED] and another one [REDACTED]';
assert.equal(actual, expected);
});
it('should not redact non session IDS', () => {
const text =
'This is a log line with a non-session ID sadsad0531032fc7415b7cc1b7516480ad121d391eddce3cfb2cee27dd5b215609c32827888\n' +
'and another one 766049a70e725ad02f7fe61b10e461380a4d7433f98096b3cacbf0362d5cab6234';
'This is a log line with a non-session ID sadsad0531032fc7415b7cc1b7516480ad121d391eddce3cfb2cee27dd5b215609c32827888 and another one 766049a70e725ad02f7fe61b10e461380a4d7433f98096b3cacbf0362d5cab6234';
const actual = Privacy.redactSessionID(text);
assert.equal(actual, text);
@ -31,12 +28,11 @@ describe('Privacy', () => {
describe('redactGroupIds', () => {
it('should redact all group IDs', () => {
const text = 'This is a log line with two group IDs: group(123456789)\nand group(abcdefghij)';
const text = 'This is a log line with two group IDs: group(123456789) and group(abcdefghij)';
const actual = Privacy.redactGroupIds(text);
const expected =
'This is a log line with two group IDs: group([REDACTED]789)\n' +
'and group([REDACTED]hij)';
'This is a log line with two group IDs: group([REDACTED]789) and group([REDACTED]hij)';
assert.equal(actual, expected);
});

View file

@ -216,10 +216,7 @@ describe('Attachment', () => {
},
});
} catch (error) {
assert.strictEqual(
error.message,
'Expected `attachment.data` to be an array buffer; got: number'
);
assert.strictEqual(error.message, 'Expected 42 to be an array buffer got: number');
return;
}