-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpredictType.test.js
More file actions
68 lines (68 loc) · 2.44 KB
/
predictType.test.js
File metadata and controls
68 lines (68 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("./index");
describe('predictColumnType', () => {
it('should return "string" for an array of strings', () => {
const input = {
values: ["aa", "bb", "cc"],
treatZeroOneAsBoolean: false
};
expect((0, index_1.predictType)(input)).toBe("string");
});
it('should return "string" for an array of strings', () => {
const input = {
values: [false, "bb", 44],
treatZeroOneAsBoolean: false
};
expect((0, index_1.predictType)(input)).toBe("string");
});
it('should return "boolean" for an array with true/false values', () => {
const input = {
values: [true, false],
treatZeroOneAsBoolean: false
};
expect((0, index_1.predictType)(input)).toBe("boolean");
});
it('should return "boolean" for an array with 0/1 if treatZeroOneAsBoolean is true', () => {
const input = {
values: ["0", "1"],
treatZeroOneAsBoolean: true
};
expect((0, index_1.predictType)(input)).toBe("boolean");
});
it('should return "number" for an array of integers', () => {
const input = {
values: [1, 2, 3],
treatZeroOneAsBoolean: false
};
expect((0, index_1.predictType)(input)).toBe("number");
});
it('should return "float" for an array of floats', () => {
const input = {
values: [1.1, 2.2, 3.3],
treatZeroOneAsBoolean: false
};
expect((0, index_1.predictType)(input)).toBe("float");
});
it('should return "float" for an array of floats', () => {
const input = {
values: [1, 2.2, 5],
treatZeroOneAsBoolean: false
};
expect((0, index_1.predictType)(input)).toBe("float");
});
it('should return "date" for an array of date strings', () => {
const input = {
values: ["2022-01-01", "2022-02-01"],
treatZeroOneAsBoolean: false
};
expect((0, index_1.predictType)(input)).toBe("date");
});
it('should return "datetime2" for an array of datetime strings', () => {
const input = {
values: ["2022-01-01T12:00:00", "2022-02-01T15:30:00"],
treatZeroOneAsBoolean: false
};
expect((0, index_1.predictType)(input)).toBe("datetime2");
});
});