-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from Contentstack-Solutions/staging
Merge staging to main
- Loading branch information
Showing
18 changed files
with
438 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
const testData = require('./boolean.ct') | ||
const testData = require("./boolean.ct"); | ||
|
||
import NullDocumentationGenerator from '../../src/lib/tsgen/docgen/nulldoc' | ||
import tsgenFactory from '../../src/lib/tsgen/factory' | ||
import NullDocumentationGenerator from "../../src/lib/tsgen/docgen/nulldoc"; | ||
import tsgenFactory from "../../src/lib/tsgen/factory"; | ||
|
||
const tsgen = tsgenFactory({ | ||
docgen: new NullDocumentationGenerator(), | ||
naming: { | ||
prefix: 'I', | ||
prefix: "I", | ||
}, | ||
}) | ||
}); | ||
|
||
describe('builtin boolean field', () => { | ||
const result = tsgen(testData.builtinBoolean) | ||
describe("builtin boolean field", () => { | ||
const result = tsgen(testData.builtinBoolean); | ||
|
||
test('metadata', () => { | ||
const types = result.metadata.types | ||
expect([...types.contentstack]).toHaveLength(0) | ||
expect([...types.globalFields]).toHaveLength(0) | ||
expect(types.javascript).toContain('boolean') | ||
}) | ||
test("metadata", () => { | ||
const types = result.metadata.types; | ||
expect([...types.contentstack]).toHaveLength(0); | ||
expect([...types.globalFields]).toHaveLength(0); | ||
expect(types.javascript).toContain("boolean"); | ||
}); | ||
|
||
test('definition', () => { | ||
test("definition", () => { | ||
expect(result.definition).toMatchInlineSnapshot(` | ||
"export interface IBoolean | ||
{ | ||
/** Version */ | ||
version: 2 ; | ||
title: string; | ||
boolean?: boolean; | ||
title: string ; | ||
boolean?: boolean ; | ||
}" | ||
`) | ||
}) | ||
}) | ||
`); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,53 @@ | ||
const testData = require('./defaults.ct') | ||
const testData = require("./defaults.ct"); | ||
|
||
import NullDocumentationGenerator from '../../src/lib/tsgen/docgen/nulldoc' | ||
import tsgenFactory from '../../src/lib/tsgen/factory' | ||
import NullDocumentationGenerator from "../../src/lib/tsgen/docgen/nulldoc"; | ||
import tsgenFactory from "../../src/lib/tsgen/factory"; | ||
|
||
const tsgen = tsgenFactory({ | ||
docgen: new NullDocumentationGenerator(), | ||
naming: { | ||
prefix: 'I', | ||
prefix: "I", | ||
}, | ||
}) | ||
}); | ||
|
||
describe('default single content block', () => { | ||
const result = tsgen(testData.defaultSingleContentBlock) | ||
describe("default single content block", () => { | ||
const result = tsgen(testData.defaultSingleContentBlock); | ||
|
||
test('definition', () => { | ||
test("definition", () => { | ||
expect(result.definition).toMatchInlineSnapshot(` | ||
"export interface IMetadataSingleContentBlock | ||
{ | ||
/** Version */ | ||
version: 2 ; | ||
title: string; | ||
title: string ; | ||
}" | ||
`) | ||
}) | ||
}) | ||
`); | ||
}); | ||
}); | ||
|
||
describe('default single webpage', () => { | ||
const result = tsgen(testData.defaultSingleWebpage) | ||
describe("default single webpage", () => { | ||
const result = tsgen(testData.defaultSingleWebpage); | ||
|
||
test('types', () => { | ||
const types = result.metadata.types | ||
expect([...types.contentstack]).toHaveLength(0) | ||
expect([...types.globalFields]).toHaveLength(0) | ||
expect(types.javascript).toContain('string') | ||
}) | ||
test("types", () => { | ||
const types = result.metadata.types; | ||
expect([...types.contentstack]).toHaveLength(0); | ||
expect([...types.globalFields]).toHaveLength(0); | ||
expect(types.javascript).toContain("string"); | ||
}); | ||
|
||
test('dependencies', () => { | ||
expect(result.metadata.dependencies.globalFields).toEqual({}) | ||
}) | ||
test("dependencies", () => { | ||
expect(result.metadata.dependencies.globalFields).toEqual({}); | ||
}); | ||
|
||
test('definition', () => { | ||
test("definition", () => { | ||
expect(result.definition).toMatchInlineSnapshot(` | ||
"export interface IMetadataSingleWebpage | ||
{ | ||
/** Version */ | ||
version: 2 ; | ||
title: string; | ||
url: string; | ||
title: string ; | ||
url: string ; | ||
}" | ||
`) | ||
}) | ||
}) | ||
`); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
const testData = require('./global.fields.ct') | ||
const testData = require("./global.fields.ct"); | ||
|
||
import NullDocumentationGenerator from '../../src/lib/tsgen/docgen/nulldoc' | ||
import tsgenFactory from '../../src/lib/tsgen/factory' | ||
import NullDocumentationGenerator from "../../src/lib/tsgen/docgen/nulldoc"; | ||
import tsgenFactory from "../../src/lib/tsgen/factory"; | ||
|
||
const tsgen = tsgenFactory({ | ||
docgen: new NullDocumentationGenerator(), | ||
naming: { | ||
prefix: 'I', | ||
prefix: "I", | ||
}, | ||
}) | ||
}); | ||
|
||
describe('global fields', () => { | ||
const result = tsgen(testData.globalFields) | ||
describe("global fields", () => { | ||
const result = tsgen(testData.globalFields); | ||
|
||
test('metadata', () => { | ||
const types = result.metadata.types | ||
test("metadata", () => { | ||
const types = result.metadata.types; | ||
|
||
expect([...types.globalFields]).toEqual(expect.arrayContaining(['ISeo'])) | ||
}) | ||
expect([...types.globalFields]).toEqual(expect.arrayContaining(["ISeo"])); | ||
}); | ||
|
||
test('global field definition', () => { | ||
const globalField = result.metadata.dependencies.globalFields.ISeo | ||
test("global field definition", () => { | ||
const globalField = result.metadata.dependencies.globalFields.ISeo; | ||
expect(globalField.definition).toMatchInlineSnapshot(` | ||
"export interface ISeo | ||
{ | ||
/** Version */ | ||
version: ; | ||
keywords?: string; | ||
description?: string; | ||
keywords?: string ; | ||
description?: string ; | ||
}" | ||
`) | ||
}) | ||
`); | ||
}); | ||
|
||
test('content type definition', () => { | ||
test("content type definition", () => { | ||
expect(result.definition).toMatchInlineSnapshot(` | ||
"export interface IGlobalFields | ||
{ | ||
/** Version */ | ||
version: 2 ; | ||
title: string; | ||
seo?: ISeo; | ||
title: string ; | ||
seo?: ISeo ; | ||
}" | ||
`) | ||
}) | ||
}) | ||
`); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,56 @@ | ||
const testData = require('./group.ct') | ||
const testData = require("./group.ct"); | ||
|
||
import NullDocumentationGenerator from '../../src/lib/tsgen/docgen/nulldoc' | ||
import tsgenFactory from '../../src/lib/tsgen/factory' | ||
import NullDocumentationGenerator from "../../src/lib/tsgen/docgen/nulldoc"; | ||
import tsgenFactory from "../../src/lib/tsgen/factory"; | ||
|
||
const tsgen = tsgenFactory({ | ||
docgen: new NullDocumentationGenerator(), | ||
}) | ||
}); | ||
|
||
describe('group', () => { | ||
const result = tsgen(testData.group) | ||
describe("group", () => { | ||
const result = tsgen(testData.group); | ||
|
||
test('metadata', () => { | ||
const types = result.metadata.types | ||
expect([...types.contentstack]).toHaveLength(0) | ||
expect([...types.globalFields]).toHaveLength(0) | ||
test("metadata", () => { | ||
const types = result.metadata.types; | ||
expect([...types.contentstack]).toHaveLength(0); | ||
expect([...types.globalFields]).toHaveLength(0); | ||
expect([...types.javascript]).toEqual( | ||
expect.arrayContaining(['string', 'number', 'boolean']) | ||
) | ||
}) | ||
expect.arrayContaining(["string", "number", "boolean"]) | ||
); | ||
}); | ||
|
||
test('definition', () => { | ||
test("definition", () => { | ||
expect(result.definition).toMatchInlineSnapshot(` | ||
"export interface Group | ||
{ | ||
/** Version */ | ||
version: 3 ; | ||
title: string; | ||
title: string ; | ||
multiple_group_max_limit?: [{ | ||
number?: number; | ||
number?: number | null ; | ||
}, { | ||
number?: number; | ||
number?: number | null ; | ||
}, { | ||
number?: number; | ||
number?: number | null ; | ||
}, { | ||
number?: number; | ||
number?: number | null ; | ||
}, { | ||
number?: number; | ||
}]; | ||
number?: number | null ; | ||
}] ; | ||
multiple_group?: { | ||
single_line?: string; | ||
}[]; | ||
single_line?: string ; | ||
}[] ; | ||
parent_group?: { | ||
rich_text_editor?: string; | ||
multi_line?: string; | ||
single_line?: string; | ||
rich_text_editor?: string ; | ||
multi_line?: string ; | ||
single_line?: string ; | ||
child_group?: { | ||
number?: number; | ||
boolean?: boolean; | ||
date?: string; | ||
}; | ||
}; | ||
number?: number | null ; | ||
boolean?: boolean ; | ||
date?: string | null ; | ||
} ; | ||
} ; | ||
}" | ||
`) | ||
}) | ||
}) | ||
`); | ||
}); | ||
}); |
Oops, something went wrong.