-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
63 lines (61 loc) · 2.4 KB
/
test.js
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
const should = require("chai").should();
const app = require("../src/index");
describe("Kotlin Class Simple", () => {
const json = {
string: "string",
char: "c",
int: 123456,
double: 2020.2,
boolean: true,
array: [1, 2, 2020.2],
};
const ans =
"\n data class JsonToKotlinMain (val string: String, val char: Char, val int: Int, val double: Double, val boolean: Boolean, val array: Array<Double>, )\n data class JsonToKotlin2 (val string: String, val char: Char, val int: Int, val double: Double, val boolean: Boolean, val array: Array<Double>, )";
describe("Data Type", function () {
it("should be string", function () {
app(json).should.be.a("string");
});
});
describe("String Match", function () {
it("should match with defined variable", function () {
app(json).should.equal(ans);
});
});
});
describe("Kotlin Class Nested", () => {
const json = {
string: "string",
char: "c",
int: 123456,
double: 2020.2,
boolean: true,
array: [1, 2, 2020.2],
simpleObject: { stringS: "string", char: "c", int: 123456 },
simpleObject2: {
string: "string",
char: "c",
int: 12,
simpleObject23: {
stringS2: "string",
char: "c",
int: 12,
simpleObject231: { stringS2: "string", char: "c", int: 12 },
},
},
};
const ans = `data class JsonToKotlinMain (val string: String, val char: Char, val int: Int, val double: Double, val boolean: Boolean, val array: Array<Double>, val simpleObject: JsonToKotlinBaseSimpleObject, val simpleObject2: JsonToKotlinBaseSimpleObject2, )
data class JsonToKotlinBaseSimpleObject (val stringS: String, val char: Char, val int: Int, )
data class JsonToKotlinBaseSimpleObject231 (val stringS2: String, val char: Char, val int: Byte, )
data class JsonToKotlinBaseSimpleObject23 (val stringS2: String, val char: Char, val int: Byte, val simpleObject231: JsonToKotlinBaseSimpleObject231, )
data class JsonToKotlinBaseSimpleObject2 (val string: String, val char: Char, val int: Byte, val simpleObject23: JsonToKotlinBaseSimpleObject23, )`;
describe("Data Type", function () {
it("should be string", function () {
app(json).should.be.a("string");
});
});
describe("String Match Fail", function () {
it("should not match with defined variable", function () {
app(json).should.not.equal(ans);
});
});
});