Skip to content

Commit

Permalink
Updated tests to check original_type.data_type
Browse files Browse the repository at this point in the history
  • Loading branch information
lancegliser committed Sep 26, 2024
1 parent 9c3ac4b commit 46d8bd0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/features/sources/Array.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,26 @@ describe("features/sources/Array", () => {
// Id
expect(features["id"].type).toBe("nominal");
expect(features["id"].data_type).toBe("string");
expect(features["id"].original_type?.data_type).toBe("string");
// Number
expect(features["number"].type).toBe("continuous");
expect(features["number"].data_type).toBe("number");
expect(features["number"].original_type?.data_type).toBe("numeric");
expect(features["number"].bounds?.min).toBeDefined();
expect(features["number"].bounds?.max).toBeDefined();
expect(features["number"].bounds?.allow_null).toBeDefined();
// Date
expect(features["date"].type).toBe("continuous");
expect(features["date"].data_type).toBe("formatted_date_time");
expect(features["date"].original_type?.data_type).toBe("datetime");
expect(features["date"].bounds?.min).toBeDefined();
expect(features["date"].bounds?.max).toBeDefined();
expect(features["date"].bounds?.allow_null).toBeDefined();
// Boolean
expect(features["boolean"].type).toBe("nominal");
expect(features["boolean"].data_type).toBe("boolean");
expect(features["boolean"].original_type?.data_type).toBe("boolean");
console.info(features);
});

it("should infer feature attributes from data using options", async () => {
Expand All @@ -72,20 +77,24 @@ describe("features/sources/Array", () => {
// Id
expect(features["id"].type).toBe(defaults.id.type);
expect(features["id"].data_type).toBe(defaults.id.data_type);
expect(features["id"].original_type?.data_type).toBe("string");
expect(features["id"].sample).toBeDefined();
// Number
expect(features["number"].type).toBe(defaults.number.type);
expect(features["number"].data_type).toBe(defaults.number.data_type);
expect(features["number"].original_type?.data_type).toBe("numeric");
expect(features["number"].sample).toBeDefined();
// Date
expect(features["date"].type).toBe(defaults.date.type);
expect(features["date"].data_type).toBe(defaults.date.data_type);
expect(features["date"].original_type?.data_type).toBe("datetime");
expect(features["date"].date_time_format).toBe(defaults.date.date_time_format);
expect(features["date"].sample).toBeDefined();
// Boolean
expect(features["boolean"].type).toBe("nominal");
expect(features["boolean"].data_type).toBe("boolean");
expect(features["boolean"].sample).toBeDefined();
expect(features["boolean"].original_type?.data_type).toBe("boolean");
});
});
});
Expand Down

0 comments on commit 46d8bd0

Please sign in to comment.