Skip to content

Commit

Permalink
Merge pull request #411 from NeonSpork/testing-error-fix
Browse files Browse the repository at this point in the history
fix(test): Explicit type in test allows TS to compile
  • Loading branch information
risenW authored Mar 7, 2022
2 parents c68c0c6 + 4126015 commit c9cc17d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/danfojs-node/test/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { assert } from "chai";
import { describe, it } from "mocha";
import { ArrayType1D } from "../dist/danfojs-base/shared/types";
import { Utils, __version } from "../dist/danfojs-node/src";
import packagejson from "../package.json";

Expand Down Expand Up @@ -147,27 +148,27 @@ describe("Utils", function () {

describe("replaceUndefinedWithNaN", function () {
it("replace undefined in Series with NaN", function () {
let data = [10.01, 2.2, undefined, 20.505, 20.22, undefined];
let data = [10.01, 2.2, undefined, 20.505, 20.22, undefined] as ArrayType1D;
assert.deepEqual(utils.replaceUndefinedWithNaN(data, true), [10.01, 2.2, NaN, 20.505, 20.22, NaN]);
});

it("replace undefined in DataFrame with NaN", function () {
let data = [[10.01, 2.2, undefined, 20.505, 20.22, undefined],
[10.01, undefined, undefined, 20.505, 20, undefined]];
let data = [[10.01, 2.2, undefined, 20.505, 20.22, undefined] as ArrayType1D,
[10.01, undefined, undefined, 20.505, 20, undefined] as ArrayType1D];

let result = [[10.01, 2.2, NaN, 20.505, 20.22, NaN],
[10.01, NaN, NaN, 20.505, 20, NaN]];
assert.deepEqual(utils.replaceUndefinedWithNaN(data, false), result);
});

it("replace null in Series with NaN", function () {
let data = [10.01, 2.2, null, 20.505, 20.22, null];
let data = [10.01, 2.2, null, 20.505, 20.22, null] as ArrayType1D;
assert.deepEqual(utils.replaceUndefinedWithNaN(data, true), [10.01, 2.2, NaN, 20.505, 20.22, NaN]);
});

it("replace null in DataFrame with NaN", function () {
let data = [[10.01, 2.2, null, 20.505, 20.22, null],
[10.01, null, null, 20.505, 20, null]];
let data = [[10.01, 2.2, null, 20.505, 20.22, null] as ArrayType1D,
[10.01, null, null, 20.505, 20, null] as ArrayType1D];

let result = [[10.01, 2.2, NaN, 20.505, 20.22, NaN],
[10.01, NaN, NaN, 20.505, 20, NaN]];
Expand Down

0 comments on commit c9cc17d

Please sign in to comment.