Page MenuHomePhabricator

[lib] Introduce server update info validators
ClosedPublic

Authored by michal on Apr 27 2023, 6:37 AM.
Tags
None
Referenced Files
F1694959: D7656.diff
Fri, May 3, 12:53 AM
Unknown Object (File)
Sun, Apr 21, 10:03 PM
Unknown Object (File)
Fri, Apr 5, 4:59 AM
Unknown Object (File)
Fri, Apr 5, 4:59 AM
Unknown Object (File)
Fri, Apr 5, 4:59 AM
Unknown Object (File)
Fri, Apr 5, 4:59 AM
Unknown Object (File)
Fri, Apr 5, 4:58 AM
Unknown Object (File)
Fri, Apr 5, 4:38 AM
Subscribers

Details

Summary

Introduce ServerUpdateInfo validator with inner validators and tests.

Depends on D7572

Test Plan

Run yarn jest

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

lib/types/validation.test.js
736 ↗(On Diff #25827)

Can we use constants?

tomek added inline comments.
lib/types/validation.test.js
749–751

Why do we have to use _findKey? Can't we just access the property of an object?

This revision is now accepted and ready to land.May 4 2023, 3:56 AM
lib/types/validation.test.js
736–744

Reminder to use constants

Use constants

lib/types/validation.test.js
749–751

We want to get the update name from

export const updateTypes = Object.freeze({
  DELETE_ACCOUNT: 0,
  UPDATE_THREAD: 1,
  UPDATE_THREAD_READ_STATUS: 2,
  DELETE_THREAD: 3,
  JOIN_THREAD: 4,
  BAD_DEVICE_TOKEN: 5,
  UPDATE_ENTRY: 6,
  UPDATE_CURRENT_USER: 7,
  UPDATE_USER: 8,
});

while knowing only the numerical value from validatorByUpdateType.