mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-15 11:36:07 -04:00
`matrix-sdk-crypto-nodejs` and `matrix-sdk-crypto-js` are no longer default members of the Cargo virtual workspace. The Github Actions workflows for the bindings now live in a `bindings_ci.yml` files (ideally, it should be in a subdirectory, `.github/workflows/bindings/ci.yml` but it doesn't work).
32 lines
1015 B
JavaScript
32 lines
1015 B
JavaScript
const { DeviceLists, UserId } = require('../');
|
|
|
|
describe(DeviceLists.name, () => {
|
|
test('can be empty', () => {
|
|
const empty = new DeviceLists();
|
|
|
|
expect(empty.isEmpty()).toStrictEqual(true);
|
|
expect(empty.changed).toHaveLength(0);
|
|
expect(empty.left).toHaveLength(0);
|
|
});
|
|
|
|
test('can be coerced empty', () => {
|
|
const empty = new DeviceLists([], []);
|
|
|
|
expect(empty.isEmpty()).toStrictEqual(true);
|
|
expect(empty.changed).toHaveLength(0);
|
|
expect(empty.left).toHaveLength(0);
|
|
});
|
|
|
|
test('returns the correct `changed` and `left`', () => {
|
|
const list = new DeviceLists([new UserId('@foo:bar.org')], [new UserId('@baz:qux.org')]);
|
|
|
|
expect(list.isEmpty()).toStrictEqual(false);
|
|
|
|
expect(list.changed).toHaveLength(1);
|
|
expect(list.changed[0].toString()).toStrictEqual('@foo:bar.org');
|
|
|
|
expect(list.left).toHaveLength(1);
|
|
expect(list.left[0].toString()).toStrictEqual('@baz:qux.org');
|
|
});
|
|
});
|