@mtcute/test 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/crypto.js CHANGED
@@ -140,6 +140,8 @@ function testCryptoProvider(c) {
140
140
  });
141
141
  it(
142
142
  "should decompose PQ to prime factors P and Q",
143
+ // since PQ factorization relies on RNG, it may take a while (or may not!)
144
+ { timeout: 1e4 },
143
145
  async () => {
144
146
  const testFactorization = async (pq, p_, q) => {
145
147
  const [p1, q1] = await c.factorizePQ(hex.decode(pq));
@@ -148,9 +150,7 @@ function testCryptoProvider(c) {
148
150
  };
149
151
  await testFactorization("17ED48941A08F981", "494C553B", "53911073");
150
152
  await testFactorization("14fcab4dfc861f45", "494c5c99", "494c778d");
151
- },
152
- // since PQ factorization relies on RNG, it may take a while (or may not!)
153
- { timeout: 1e4 }
153
+ }
154
154
  );
155
155
  it("should correctly gzip", () => {
156
156
  const data = new Uint8Array(1e3).fill(66);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mtcute/test",
3
3
  "type": "module",
4
- "version": "0.21.0",
4
+ "version": "0.22.0",
5
5
  "description": "Test utilities for mtcute",
6
6
  "license": "MIT",
7
7
  "dependencies": {
@@ -10,10 +10,10 @@
10
10
  "@fuman/net": "0.0.9"
11
11
  },
12
12
  "peerDependencies": {
13
- "@mtcute/core": "^0.21.0",
14
- "@mtcute/node": "^0.21.0",
15
- "@mtcute/tl": "198.0.0",
16
- "@mtcute/web": "^0.21.0",
13
+ "@mtcute/core": "^0.22.0",
14
+ "@mtcute/node": "^0.22.0",
15
+ "@mtcute/tl": "200.0.0",
16
+ "@mtcute/web": "^0.22.0",
17
17
  "vitest": "*"
18
18
  },
19
19
  "exports": {
package/storage/peers.js CHANGED
@@ -42,7 +42,7 @@ function testPeersRepository(repo, driver) {
42
42
  const stupPeerMinUser = { ...stubPeerUser, isMin: true };
43
43
  describe("peers", () => {
44
44
  it("should be empty by default", async () => {
45
- expect(await repo.getById(123123, false)).toEqual(null);
45
+ expect(await repo.getById(123123)).toEqual(null);
46
46
  expect(await repo.getByUsername("some_user")).toEqual(null);
47
47
  expect(await repo.getByPhone("phone")).toEqual(null);
48
48
  });
@@ -50,10 +50,10 @@ function testPeersRepository(repo, driver) {
50
50
  await repo.store(stubPeerUser);
51
51
  await repo.store(stubPeerChannel);
52
52
  await driver.save?.();
53
- expect(fixPeerInfo(await repo.getById(123123, false))).toEqual(stubPeerUser);
53
+ expect(fixPeerInfo(await repo.getById(123123))).toEqual(stubPeerUser);
54
54
  expect(fixPeerInfo(await repo.getByUsername("some_user"))).toEqual(stubPeerUser);
55
55
  expect(fixPeerInfo(await repo.getByPhone("78005553535"))).toEqual(stubPeerUser);
56
- expect(fixPeerInfo(await repo.getById(-1001183945448, false))).toEqual(stubPeerChannel);
56
+ expect(fixPeerInfo(await repo.getById(-1001183945448))).toEqual(stubPeerChannel);
57
57
  expect(fixPeerInfo(await repo.getByUsername("some_channel"))).toEqual(stubPeerChannel);
58
58
  });
59
59
  it("should update peers usernames", async () => {
@@ -62,18 +62,17 @@ function testPeersRepository(repo, driver) {
62
62
  const modUser = { ...stubPeerUser, usernames: ["some_user2"] };
63
63
  await repo.store(modUser);
64
64
  await driver.save?.();
65
- expect(fixPeerInfo(await repo.getById(123123, false))).toEqual(modUser);
65
+ expect(fixPeerInfo(await repo.getById(123123))).toEqual(modUser);
66
66
  expect(await repo.getByUsername("some_user")).toEqual(null);
67
67
  expect(fixPeerInfo(await repo.getByUsername("some_user2"))).toEqual(modUser);
68
68
  });
69
- it("should not return min peers by default", async () => {
69
+ it("only getById should return min peers", async () => {
70
70
  await repo.deleteAll();
71
71
  await repo.store(stupPeerMinUser);
72
72
  await driver.save?.();
73
- expect(await repo.getById(123123, false)).toEqual(null);
74
73
  expect(await repo.getByUsername("some_user")).toEqual(null);
75
74
  expect(await repo.getByPhone("78005553535")).toEqual(null);
76
- expect(fixPeerInfo(await repo.getById(123123, true))).toEqual(stupPeerMinUser);
75
+ expect(fixPeerInfo(await repo.getById(123123))).toEqual(stupPeerMinUser);
77
76
  });
78
77
  });
79
78
  }