mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-04-30 12:04:25 -04:00
First, u128 has a bug in `serde`, cf. https://github.com/serde-rs/json/issues/625. Second, we don't need to represent the timeout as a u128, it's clearly too large. This patch tries to convert it to u64. It should never fail, but we propagate the error anyway.
30 lines
1.0 KiB
JavaScript
30 lines
1.0 KiB
JavaScript
const { RequestType, KeysUploadRequest, KeysQueryRequest, KeysClaimRequest, ToDeviceRequest, SignatureUploadRequest, RoomMessageRequest, KeysBackupRequest } = require('../');
|
|
|
|
describe('RequestType', () => {
|
|
test('has the correct variant values', () => {
|
|
expect(RequestType.KeysUpload).toStrictEqual(0);
|
|
expect(RequestType.KeysQuery).toStrictEqual(1);
|
|
expect(RequestType.KeysClaim).toStrictEqual(2);
|
|
expect(RequestType.ToDevice).toStrictEqual(3);
|
|
expect(RequestType.SignatureUpload).toStrictEqual(4);
|
|
expect(RequestType.RoomMessage).toStrictEqual(5);
|
|
expect(RequestType.KeysBackup).toStrictEqual(6);
|
|
});
|
|
});
|
|
|
|
for (const request of [
|
|
KeysUploadRequest,
|
|
KeysQueryRequest,
|
|
KeysClaimRequest,
|
|
ToDeviceRequest,
|
|
SignatureUploadRequest,
|
|
RoomMessageRequest,
|
|
KeysBackupRequest,
|
|
]) {
|
|
describe(request.name, () => {
|
|
test('cannot be instantiated', () => {
|
|
expect(() => { new (request)() }).toThrow();
|
|
});
|
|
})
|
|
}
|