Skip to content

Commit e8d077a

Browse files
committed
replace jasmine expect().withContext() with Jest/vitest expect() 2nd argument
1 parent 57efe2c commit e8d077a

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

packages/cosmwasm-stargate/src/compression.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe("compression", () => {
3434
// - [...]
3535
// - and an 8-byte footer, containing a CRC-32 checksum and the length of the original uncompressed data."
3636
// https://bits.ashleyblewer.com/blog/2024/01/12/researching-file-formats-20-gzip/
37-
expect(compressed.length).withContext(`Data with index ${index}`).toBeGreaterThanOrEqual(18);
37+
expect(compressed.length, `Data with index ${index}`).toBeGreaterThanOrEqual(18);
3838
expect(compressed.slice(0, 3)).toEqual(fromHex("1F8B08"));
3939
expect(compressed.subarray(-4)).toEqual(new Uint32(original.length).toBytesLittleEndian());
4040
expect(await uncompress(compressed)).toEqual(original);

packages/crypto/src/pbkdf2.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ describe("pbkdf2", () => {
115115
for (const [index, test] of brycxTests.entries()) {
116116
const { secret, salt, iterations, keylen, expected } = test;
117117
const hash = await pbkdf2Sha512(secret, salt, iterations, keylen);
118-
expect(hash).withContext(`brycx tests index ${index}`).toEqual(expected);
118+
expect(hash, `brycx tests index ${index}`).toEqual(expected);
119119
}
120120
});
121121
});
@@ -136,7 +136,7 @@ describe("pbkdf2", () => {
136136
for (const [index, test] of brycxTests.entries()) {
137137
const { secret, salt, iterations, keylen, expected } = test;
138138
const hash = await pbkdf2Sha512Subtle(subtle, secret, salt, iterations, keylen);
139-
expect(hash).withContext(`brycx tests index ${index}`).toEqual(expected);
139+
expect(hash, `brycx tests index ${index}`).toEqual(expected);
140140
}
141141
});
142142
});
@@ -152,7 +152,7 @@ describe("pbkdf2", () => {
152152
for (const [index, test] of brycxTests.entries()) {
153153
const { secret, salt, iterations, keylen, expected } = test;
154154
const hash = await pbkdf2Sha512Noble(secret, salt, iterations, keylen);
155-
expect(hash).withContext(`brycx tests index ${index}`).toEqual(expected);
155+
expect(hash, `brycx tests index ${index}`).toEqual(expected);
156156
}
157157
}, 120_000);
158158
});

packages/crypto/src/secp256k1.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ describe("Secp256k1", () => {
389389
messageHash,
390390
pubkey,
391391
);
392-
expect(isValid).withContext(`(index ${index})`).toEqual(true);
392+
expect(isValid, `(index ${index})`).toEqual(true);
393393
}
394394
});
395395

@@ -501,18 +501,18 @@ describe("Secp256k1", () => {
501501

502502
// verify calculated signature
503503
const ok1 = await Secp256k1.verifySignature(calculatedSignature, messageHash, keypair.pubkey);
504-
expect(ok1).withContext(`(index ${index})`).toEqual(true);
504+
expect(ok1, `(index ${index})`).toEqual(true);
505505

506506
// verify original signature
507507
const ok2 = await Secp256k1.verifySignature(
508508
Secp256k1Signature.fromDer(row.signature),
509509
messageHash,
510510
keypair.pubkey,
511511
);
512-
expect(ok2).withContext(`(index ${index})`).toEqual(true);
512+
expect(ok2, `(index ${index})`).toEqual(true);
513513

514514
// compare signatures
515-
expect(calculatedSignature.toDer()).withContext(`(index ${index})`).toEqual(row.signature);
515+
expect(calculatedSignature.toDer(), `(index ${index})`).toEqual(row.signature);
516516
}
517517
});
518518

packages/encoding/src/base64.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ describe("base64", () => {
7979
// "aa==", // non-strict, should be aQ==
8080
];
8181
for (const input of invalid) {
82-
expect(() => fromBase64(input))
83-
.withContext(`invalid input: '${input}'`)
84-
.toThrow();
82+
expect(() => fromBase64(input), `invalid input: '${input}'`).toThrow();
8583
}
8684
});
8785

packages/stargate/src/fee.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ describe("GasPrice", () => {
6363
};
6464
for (const [input, expected] of Object.entries(inputs)) {
6565
const gasPrice = GasPrice.fromString(input);
66-
expect(gasPrice.amount.toString()).withContext(`Input: ${input}`).toEqual(expected.amount);
67-
expect(gasPrice.denom).withContext(`Input: ${input}`).toEqual(expected.denom);
66+
expect(gasPrice.amount.toString(), `Input: ${input}`).toEqual(expected.amount);
67+
expect(gasPrice.denom, `Input: ${input}`).toEqual(expected.denom);
6868
}
6969
});
7070

0 commit comments

Comments
 (0)