Skip to content

Commit 17b1dca

Browse files
committed
fix types in tests
1 parent aac5415 commit 17b1dca

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

test/codec-float.test.ts

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import assert from "assert";
22
import { decode } from "../src";
3-
// ieee754 module's type declarations are too strict
4-
// https://github.com/feross/ieee754/pull/38
5-
// @ts-nocheck
63
import * as ieee754 from "ieee754";
74

8-
95
const FLOAT32_TYPE = 0xca;
106
const FLOAT64_TYPE = 0xcb;
117

@@ -33,11 +29,9 @@ const SPECS = {
3329

3430
describe("codec: float 32/64", () => {
3531
context("float 32", () => {
36-
for (const name of Object.keys(SPECS)) {
37-
const value = SPECS[name];
38-
32+
for (const [name, value] of Object.entries(SPECS)) {
3933
it(`decodes ${name} (${value})`, () => {
40-
const buf: Array<number> = [];
34+
const buf = new Uint8Array(4);
4135
ieee754.write(buf, value, 0, false, 23, 4);
4236
const expected = ieee754.read(buf, 0, false, 23, 4);
4337

@@ -47,7 +41,7 @@ describe("codec: float 32/64", () => {
4741
}
4842

4943
it(`decodes NaN`, () => {
50-
const buf: Array<number> = [];
44+
const buf = new Uint8Array(4);
5145
ieee754.write(buf, NaN, 0, false, 23, 4);
5246
const expected = ieee754.read(buf, 0, false, 23, 4);
5347

@@ -56,11 +50,9 @@ describe("codec: float 32/64", () => {
5650
});
5751

5852
context("float 64", () => {
59-
for (const name of Object.keys(SPECS)) {
60-
const value = SPECS[name];
61-
53+
for (const [name, value] of Object.entries(SPECS)) {
6254
it(`decodes ${name} (${value})`, () => {
63-
const buf: Array<number> = [];
55+
const buf = new Uint8Array(8);
6456
ieee754.write(buf, value, 0, false, 52, 8);
6557
const expected = ieee754.read(buf, 0, false, 52, 8);
6658

@@ -70,7 +62,7 @@ describe("codec: float 32/64", () => {
7062
}
7163

7264
it(`decodes NaN`, () => {
73-
const buf: Array<number> = [];
65+
const buf = new Uint8Array(8);
7466
ieee754.write(buf, NaN, 0, false, 52, 8);
7567
const expected = ieee754.read(buf, 0, false, 52, 8);
7668

0 commit comments

Comments
 (0)