-
-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Desktop: Fixes #9985: Filter Sync Target Info Logs #10014
Changes from 5 commits
054b988
b319fdd
0e79f4f
441b85e
612b705
320a8cc
32d6dfa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -200,6 +200,55 @@ describe('syncInfoUtils', () => { | |
logger.enabled = true; | ||
}); | ||
|
||
// cSpell:disable | ||
it('should filter unnecessary sync info', async () => { | ||
const syncInfo = new SyncInfo(); | ||
syncInfo.masterKeys = [{ | ||
id: '1', | ||
content: 'longstringverylongstringlongstringverylongstringlongstringverylongstring', | ||
checksum: 'longstringverylongstringlongstringverylongstringlongstringverylongstring', | ||
}]; | ||
syncInfo.ppk = { | ||
id: '1', | ||
publicKey: 'longstringverylongstringlongstringverylongstringlongstringverylongstring', | ||
privateKey: { | ||
encryptionMethod: 1, | ||
ciphertext: 'longstringverylongstringlongstringverylongstringlongstringverylongstring', | ||
}, | ||
createdTime: 0, | ||
keySize: 0, | ||
}; | ||
const filteredSyncInfo = syncInfo.filterSyncInfo(); | ||
const originalSyncInfo = syncInfo.toObject(); | ||
|
||
expect(filteredSyncInfo).toEqual({ | ||
activeMasterKeyId_: originalSyncInfo.activeMasterKeyId, | ||
appMinVersion_: originalSyncInfo.appMinVersion, | ||
e2ee_: originalSyncInfo.e2ee, | ||
version_: originalSyncInfo.version, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When you create a test you should not use dynamic data, especially not data that comes from the data you're supposed to check. So all these should be static strings/numbers. |
||
masterKeys_: [ | ||
// Content & Checksum are removed | ||
{ id: '1' }, | ||
], | ||
ppk_: { | ||
value: { | ||
// Public Key is truncated to 40 characters | ||
publicKey: 'longstringverylongstringlongstringverylo', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you mind adding "..." to this string too to show it's truncated? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And please remove all the comments. They are not necessary and are likely to become outdated. |
||
privateKey: { | ||
// Private Key is truncated to first and last 20 characters | ||
ciphertext: 'longstringverylongst...stringverylongstring', | ||
encryptionMethod: 1, | ||
}, | ||
id: '1', | ||
createdTime: 0, | ||
keySize: 0, | ||
}, | ||
updatedTime: originalSyncInfo.ppk.updatedTime, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
}, | ||
}); | ||
}); | ||
laurent22 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// cSpell:enable | ||
|
||
test.each([ | ||
['1.0.0', '1.0.4', true], | ||
['1.0.0', '0.0.5', false], | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you try the app and use more realistic data? Checking that the time or size is 0 is not a good test - it might be 0 because of a bug.