Page MenuHomePhabricator

[lib] Introduce server update info validators
ClosedPublic

Authored by michal on Apr 27 2023, 6:37 AM.
Tags
None
Referenced Files
F3367397: D7656.id.diff
Mon, Nov 25, 2:46 PM
F3367349: D7656.id.diff
Mon, Nov 25, 2:36 PM
Unknown Object (File)
Wed, Nov 20, 6:27 PM
Unknown Object (File)
Sat, Nov 16, 3:31 AM
Unknown Object (File)
Tue, Nov 12, 11:17 AM
Unknown Object (File)
Sun, Nov 10, 7:59 PM
Unknown Object (File)
Mon, Nov 4, 12:17 PM
Unknown Object (File)
Mon, Nov 4, 12:17 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 ↗(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.