Page MenuHomePhabricator

[lib] Add unit tests for functions modifying device list
ClosedPublic

Authored by bartek on May 29 2024, 9:49 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jun 19, 11:18 PM
Unknown Object (File)
Sat, Jun 15, 5:36 PM
Unknown Object (File)
Sat, Jun 15, 2:31 PM
Unknown Object (File)
Sat, Jun 15, 12:12 PM
Unknown Object (File)
Sun, Jun 9, 10:27 AM
Unknown Object (File)
Sat, Jun 8, 10:57 PM
Unknown Object (File)
Sat, Jun 8, 4:50 AM
Unknown Object (File)
Fri, Jun 7, 5:32 AM
Subscribers

Details

Summary

Added unit tests for functions from D12238 and D12239.

Depends on D12239

Test Plan

Unit tests for lib

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.May 29 2024, 10:13 AM

nice 👏

lib/shared/device-list-utils.test.js
279 ↗(On Diff #40753)

can we avoid any here and use something like JestMatcher?

283 ↗(On Diff #40753)

looks like a hack but if there isn't any better solution for it probably it's okay as it's only for testing purpose

This revision is now accepted and ready to land.Mon, Jun 3, 4:51 AM
lib/shared/device-list-utils.test.js
279 ↗(On Diff #40753)

Checked Flow types of jest matcher and they use any 😶 Can narrow down to Object which is better

283 ↗(On Diff #40753)

It is a hack, but thanks to this it also checks one more thing:

  • raw device list JSON should always be ordered: { devices, timestamp }, The order matters because it's signed in this form. Thanks to this, we can serialize and deserialize it at various points and the signature should still be valid