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)
Sat, Jul 20, 11:19 PM
Unknown Object (File)
Thu, Jul 18, 3:08 PM
Unknown Object (File)
Wed, Jul 17, 10:08 PM
Unknown Object (File)
Mon, Jul 15, 12:47 PM
Unknown Object (File)
Sun, Jul 14, 9:31 AM
Unknown Object (File)
Sun, Jul 14, 9:31 AM
Unknown Object (File)
Sat, Jul 13, 12:42 PM
Unknown Object (File)
Wed, Jun 26, 11:27 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
Lint Not Applicable
Unit
Tests Not Applicable

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 ↗(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.