Skip to content

Commit 0bf1c9f

Browse files
committed
test: minor uint8array style improvement
1 parent 5c10272 commit 0bf1c9f

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

test/point.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ describe('basic curve tests', () => {
355355
}
356356
throws(() => C.getPublicKey('key'), "'key'");
357357
throws(() => C.getPublicKey({}));
358-
throws(() => C.getPublicKey(new Uint8Array([])));
358+
throws(() => C.getPublicKey(Uint8Array.of()));
359359
throws(() => C.getPublicKey(Array(32).fill(1)));
360360
});
361361

@@ -388,7 +388,7 @@ describe('basic curve tests', () => {
388388
// )
389389
// );
390390
should('.verify() should verify empty signatures', () => {
391-
const msg = new Uint8Array([]);
391+
const msg = Uint8Array.of();
392392
const k = C.keygen();
393393
const sig = C.sign(msg, k.secretKey);
394394
eql(
@@ -399,7 +399,7 @@ describe('basic curve tests', () => {
399399
});
400400

401401
should('.sign() type tests', () => {
402-
const msg = new Uint8Array([]);
402+
const msg = Uint8Array.of();
403403
const k = C.keygen();
404404
C.sign(msg, k.secretKey);
405405
for (let [item, repr_] of getTypeTests()) {
@@ -513,7 +513,7 @@ describe('basic curve tests', () => {
513513
}
514514

515515
// NOTE: fails for ed, because of empty message. Since we convert it to scalar,
516-
// need to check what other implementations do. Empty message != new Uint8Array([0]), but what scalar should be in that case?
516+
// need to check what other implementations do. Empty message != Uint8Array.of(0), but what scalar should be in that case?
517517
// should('should not verify signature with wrong message', () => {
518518
// fc.assert(
519519
// fc.property(

test/utils.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ describe('utils', () => {
107107
for (const s of UTF8) throws(() => asciiToBytes(s));
108108
const bytesOK = [
109109
new Uint8Array([72, 101, 108, 108, 111]),
110-
new Uint8Array([0]),
111-
new Uint8Array([]),
110+
Uint8Array.of(0),
111+
Uint8Array.of(),
112112
new Uint8Array([127]),
113113
];
114114
const bytesFAIL = [

test/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ export const getTypeTests = () => [
5555
['0xbe', '"0xbe"'],
5656
['keys', '"keys"'],
5757
[new String('1234'), 'String(1234)'],
58-
[new Uint8Array([]), 'ui8a([])'],
59-
[new Uint8Array([0]), 'ui8a([0])'],
60-
[new Uint8Array([1]), 'ui8a([1])'],
58+
[Uint8Array.of(), 'ui8a([])'],
59+
[Uint8Array.of(0), 'ui8a([0])'],
60+
[Uint8Array.of(1), 'ui8a([1])'],
6161
// [new Uint8Array(32).fill(1), 'ui8a(32*[1])'],
6262
[new Uint8Array(4096).fill(1), 'ui8a(4096*[1])'],
6363
[new Uint16Array(32).fill(1), 'ui16a(32*[1])'],

0 commit comments

Comments
 (0)