Page MenuHomePhabricator

[lib] Introduce server update info validators
ClosedPublic

Authored by michal on Apr 27 2023, 6:37 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 29, 9:16 AM
Unknown Object (File)
Fri, Nov 29, 7:21 AM
Unknown Object (File)
Thu, Nov 28, 12:08 PM
Unknown Object (File)
Mon, Nov 25, 9:34 PM
Unknown Object (File)
Mon, Nov 25, 8:48 PM
Unknown Object (File)
Mon, Nov 25, 8:48 PM
Unknown Object (File)
Mon, Nov 25, 2:46 PM
Unknown Object (File)
Mon, Nov 25, 2:36 PM
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

Can we use constants?

tomek added inline comments.
lib/types/validation.test.js
749–751 ↗(On Diff #26062)

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 ↗(On Diff #26062)

Reminder to use constants

Use constants

lib/types/validation.test.js
749–751 ↗(On Diff #26062)

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.