Skip to content

Commit 5bacf6a

Browse files
committed
test cases fix and workflow update
1 parent 00684c4 commit 5bacf6a

14 files changed

Lines changed: 276 additions & 275 deletions

.github/workflows/node.js.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ name: Node.js CI
55

66
on:
77
push:
8-
branches: [ master ]
8+
branches: [ master, development, staging ]
99
pull_request:
10-
branches: [ master ]
10+
branches: [ master, development, staging ]
1111

1212
jobs:
1313
build:

tests/tsgen/boolean.test.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
const testData = require('./boolean.ct')
1+
const testData = require("./boolean.ct");
22

3-
import NullDocumentationGenerator from '../../src/lib/tsgen/docgen/nulldoc'
4-
import tsgenFactory from '../../src/lib/tsgen/factory'
3+
import NullDocumentationGenerator from "../../src/lib/tsgen/docgen/nulldoc";
4+
import tsgenFactory from "../../src/lib/tsgen/factory";
55

66
const tsgen = tsgenFactory({
77
docgen: new NullDocumentationGenerator(),
88
naming: {
9-
prefix: 'I',
9+
prefix: "I",
1010
},
11-
})
11+
});
1212

13-
describe('builtin boolean field', () => {
14-
const result = tsgen(testData.builtinBoolean)
13+
describe("builtin boolean field", () => {
14+
const result = tsgen(testData.builtinBoolean);
1515

16-
test('metadata', () => {
17-
const types = result.metadata.types
18-
expect([...types.contentstack]).toHaveLength(0)
19-
expect([...types.globalFields]).toHaveLength(0)
20-
expect(types.javascript).toContain('boolean')
21-
})
16+
test("metadata", () => {
17+
const types = result.metadata.types;
18+
expect([...types.contentstack]).toHaveLength(0);
19+
expect([...types.globalFields]).toHaveLength(0);
20+
expect(types.javascript).toContain("boolean");
21+
});
2222

23-
test('definition', () => {
23+
test("definition", () => {
2424
expect(result.definition).toMatchInlineSnapshot(`
2525
"export interface IBoolean
2626
{
2727
/** Version */
2828
version: 2 ;
29-
title: string;
30-
boolean?: boolean;
29+
title: string ;
30+
boolean?: boolean | null ;
3131
}"
32-
`)
33-
})
34-
})
32+
`);
33+
});
34+
});

tests/tsgen/defaults.test.ts

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
1-
const testData = require('./defaults.ct')
1+
const testData = require("./defaults.ct");
22

3-
import NullDocumentationGenerator from '../../src/lib/tsgen/docgen/nulldoc'
4-
import tsgenFactory from '../../src/lib/tsgen/factory'
3+
import NullDocumentationGenerator from "../../src/lib/tsgen/docgen/nulldoc";
4+
import tsgenFactory from "../../src/lib/tsgen/factory";
55

66
const tsgen = tsgenFactory({
77
docgen: new NullDocumentationGenerator(),
88
naming: {
9-
prefix: 'I',
9+
prefix: "I",
1010
},
11-
})
11+
});
1212

13-
describe('default single content block', () => {
14-
const result = tsgen(testData.defaultSingleContentBlock)
13+
describe("default single content block", () => {
14+
const result = tsgen(testData.defaultSingleContentBlock);
1515

16-
test('definition', () => {
16+
test("definition", () => {
1717
expect(result.definition).toMatchInlineSnapshot(`
1818
"export interface IMetadataSingleContentBlock
1919
{
2020
/** Version */
2121
version: 2 ;
22-
title: string;
22+
title: string ;
2323
}"
24-
`)
25-
})
26-
})
24+
`);
25+
});
26+
});
2727

28-
describe('default single webpage', () => {
29-
const result = tsgen(testData.defaultSingleWebpage)
28+
describe("default single webpage", () => {
29+
const result = tsgen(testData.defaultSingleWebpage);
3030

31-
test('types', () => {
32-
const types = result.metadata.types
33-
expect([...types.contentstack]).toHaveLength(0)
34-
expect([...types.globalFields]).toHaveLength(0)
35-
expect(types.javascript).toContain('string')
36-
})
31+
test("types", () => {
32+
const types = result.metadata.types;
33+
expect([...types.contentstack]).toHaveLength(0);
34+
expect([...types.globalFields]).toHaveLength(0);
35+
expect(types.javascript).toContain("string");
36+
});
3737

38-
test('dependencies', () => {
39-
expect(result.metadata.dependencies.globalFields).toEqual({})
40-
})
38+
test("dependencies", () => {
39+
expect(result.metadata.dependencies.globalFields).toEqual({});
40+
});
4141

42-
test('definition', () => {
42+
test("definition", () => {
4343
expect(result.definition).toMatchInlineSnapshot(`
4444
"export interface IMetadataSingleWebpage
4545
{
4646
/** Version */
4747
version: 2 ;
48-
title: string;
49-
url: string;
48+
title: string ;
49+
url: string ;
5050
}"
51-
`)
52-
})
53-
})
51+
`);
52+
});
53+
});

tests/tsgen/global.fields.test.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
1-
const testData = require('./global.fields.ct')
1+
const testData = require("./global.fields.ct");
22

3-
import NullDocumentationGenerator from '../../src/lib/tsgen/docgen/nulldoc'
4-
import tsgenFactory from '../../src/lib/tsgen/factory'
3+
import NullDocumentationGenerator from "../../src/lib/tsgen/docgen/nulldoc";
4+
import tsgenFactory from "../../src/lib/tsgen/factory";
55

66
const tsgen = tsgenFactory({
77
docgen: new NullDocumentationGenerator(),
88
naming: {
9-
prefix: 'I',
9+
prefix: "I",
1010
},
11-
})
11+
});
1212

13-
describe('global fields', () => {
14-
const result = tsgen(testData.globalFields)
13+
describe("global fields", () => {
14+
const result = tsgen(testData.globalFields);
1515

16-
test('metadata', () => {
17-
const types = result.metadata.types
16+
test("metadata", () => {
17+
const types = result.metadata.types;
1818

19-
expect([...types.globalFields]).toEqual(expect.arrayContaining(['ISeo']))
20-
})
19+
expect([...types.globalFields]).toEqual(expect.arrayContaining(["ISeo"]));
20+
});
2121

22-
test('global field definition', () => {
23-
const globalField = result.metadata.dependencies.globalFields.ISeo
22+
test("global field definition", () => {
23+
const globalField = result.metadata.dependencies.globalFields.ISeo;
2424
expect(globalField.definition).toMatchInlineSnapshot(`
2525
"export interface ISeo
2626
{
2727
/** Version */
2828
version: ;
29-
keywords?: string;
30-
description?: string;
29+
keywords?: string | null ;
30+
description?: string | null ;
3131
}"
32-
`)
33-
})
32+
`);
33+
});
3434

35-
test('content type definition', () => {
35+
test("content type definition", () => {
3636
expect(result.definition).toMatchInlineSnapshot(`
3737
"export interface IGlobalFields
3838
{
3939
/** Version */
4040
version: 2 ;
41-
title: string;
42-
seo?: ISeo;
41+
title: string ;
42+
seo?: ISeo | null ;
4343
}"
44-
`)
45-
})
46-
})
44+
`);
45+
});
46+
});

tests/tsgen/group.test.ts

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
1-
const testData = require('./group.ct')
1+
const testData = require("./group.ct");
22

3-
import NullDocumentationGenerator from '../../src/lib/tsgen/docgen/nulldoc'
4-
import tsgenFactory from '../../src/lib/tsgen/factory'
3+
import NullDocumentationGenerator from "../../src/lib/tsgen/docgen/nulldoc";
4+
import tsgenFactory from "../../src/lib/tsgen/factory";
55

66
const tsgen = tsgenFactory({
77
docgen: new NullDocumentationGenerator(),
8-
})
8+
});
99

10-
describe('group', () => {
11-
const result = tsgen(testData.group)
10+
describe("group", () => {
11+
const result = tsgen(testData.group);
1212

13-
test('metadata', () => {
14-
const types = result.metadata.types
15-
expect([...types.contentstack]).toHaveLength(0)
16-
expect([...types.globalFields]).toHaveLength(0)
13+
test("metadata", () => {
14+
const types = result.metadata.types;
15+
expect([...types.contentstack]).toHaveLength(0);
16+
expect([...types.globalFields]).toHaveLength(0);
1717
expect([...types.javascript]).toEqual(
18-
expect.arrayContaining(['string', 'number', 'boolean'])
19-
)
20-
})
18+
expect.arrayContaining(["string", "number", "boolean"])
19+
);
20+
});
2121

22-
test('definition', () => {
22+
test("definition", () => {
2323
expect(result.definition).toMatchInlineSnapshot(`
2424
"export interface Group
2525
{
2626
/** Version */
2727
version: 3 ;
28-
title: string;
28+
title: string ;
2929
multiple_group_max_limit?: [{
30-
number?: number;
30+
number?: number | null ;
3131
}, {
32-
number?: number;
32+
number?: number | null ;
3333
}, {
34-
number?: number;
34+
number?: number | null ;
3535
}, {
36-
number?: number;
36+
number?: number | null ;
3737
}, {
38-
number?: number;
39-
}];
38+
number?: number | null ;
39+
}] | null ;
4040
multiple_group?: {
41-
single_line?: string;
42-
}[];
41+
single_line?: string | null ;
42+
}[] | null ;
4343
parent_group?: {
44-
rich_text_editor?: string;
45-
multi_line?: string;
46-
single_line?: string;
44+
rich_text_editor?: string | null ;
45+
multi_line?: string | null ;
46+
single_line?: string | null ;
4747
child_group?: {
48-
number?: number;
49-
boolean?: boolean;
50-
date?: string;
51-
};
52-
};
48+
number?: number | null ;
49+
boolean?: boolean | null ;
50+
date?: string | null ;
51+
} | null ;
52+
} | null ;
5353
}"
54-
`)
55-
})
56-
})
54+
`);
55+
});
56+
});

tests/tsgen/isodate.test.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
const testData = require('./isodate.ct')
1+
const testData = require("./isodate.ct");
22

3-
import NullDocumentationGenerator from '../../src/lib/tsgen/docgen/nulldoc'
4-
import tsgenFactory from '../../src/lib/tsgen/factory'
3+
import NullDocumentationGenerator from "../../src/lib/tsgen/docgen/nulldoc";
4+
import tsgenFactory from "../../src/lib/tsgen/factory";
55

66
const tsgen = tsgenFactory({
77
docgen: new NullDocumentationGenerator(),
8-
})
8+
});
99

10-
describe('builtin isodate field', () => {
11-
const result = tsgen(testData.builtinIsodate)
10+
describe("builtin isodate field", () => {
11+
const result = tsgen(testData.builtinIsodate);
1212

1313
/*
1414
* Isodates are returned as strings
1515
*/
16-
test('metadata', () => {
17-
const types = result.metadata.types
18-
expect([...types.contentstack]).toHaveLength(0)
19-
expect([...types.globalFields]).toHaveLength(0)
20-
expect(types.javascript).toContain('string')
21-
})
16+
test("metadata", () => {
17+
const types = result.metadata.types;
18+
expect([...types.contentstack]).toHaveLength(0);
19+
expect([...types.globalFields]).toHaveLength(0);
20+
expect(types.javascript).toContain("string");
21+
});
2222

23-
test('definition', () => {
23+
test("definition", () => {
2424
expect(result.definition).toMatchInlineSnapshot(`
2525
"export interface Isodate
2626
{
2727
/** Version */
2828
version: 2 ;
29-
title: string;
30-
date?: string;
31-
date_required: string;
32-
date_multiple?: string[];
33-
date_multiple_maxlength?: [string, string, string, string, string];
34-
date_required_multiple_maxlength: [string, string, string, string, string, string, string, string];
29+
title: string ;
30+
date?: string | null ;
31+
date_required: string ;
32+
date_multiple?: string[] | null ;
33+
date_multiple_maxlength?: [string, string, string, string, string] | null ;
34+
date_required_multiple_maxlength: [string, string, string, string, string, string, string, string] ;
3535
}"
36-
`)
37-
})
38-
})
36+
`);
37+
});
38+
});

0 commit comments

Comments
 (0)