From 37276c4b392d82226c7c308388b53315182a58a8 Mon Sep 17 00:00:00 2001 From: MohammedZuhairAhmed Date: Mon, 20 May 2024 15:43:09 +0530 Subject: [PATCH] integration test initialized --- .../integration/generateTS/generateTS.test.ts | 389 ++++++++++++++++++ tests/integration/graphqlTS/graphqlTS.test.ts | 219 ++++++++++ tests/{ => unit}/tsgen/boolean.ct.js | 0 tests/{ => unit}/tsgen/boolean.test.ts | 4 +- tests/{ => unit}/tsgen/defaults.ct.js | 0 tests/{ => unit}/tsgen/defaults.test.ts | 4 +- tests/{ => unit}/tsgen/global.fields.ct.js | 0 tests/{ => unit}/tsgen/global.fields.test.ts | 4 +- tests/{ => unit}/tsgen/group.ct.js | 0 tests/{ => unit}/tsgen/group.test.ts | 4 +- tests/{ => unit}/tsgen/initialization.ct.js | 0 tests/{ => unit}/tsgen/initialization.test.ts | 4 +- tests/{ => unit}/tsgen/isodate.ct.js | 0 tests/{ => unit}/tsgen/isodate.test.ts | 4 +- tests/{ => unit}/tsgen/jsdoc.ct.js | 0 tests/{ => unit}/tsgen/jsdoc.test.ts | 4 +- tests/{ => unit}/tsgen/modular.blocks.ct.js | 0 tests/{ => unit}/tsgen/modular.blocks.test.ts | 4 +- tests/{ => unit}/tsgen/number.ct.js | 0 tests/{ => unit}/tsgen/number.test.ts | 4 +- tests/{ => unit}/tsgen/options.ct.js | 0 tests/{ => unit}/tsgen/options.test.ts | 4 +- tests/{ => unit}/tsgen/references.ct.js | 0 tests/{ => unit}/tsgen/references.test.ts | 4 +- tests/{ => unit}/tsgen/select.ct.js | 0 tests/{ => unit}/tsgen/select.test.ts | 4 +- tests/{ => unit}/tsgen/string.ct.js | 0 tests/{ => unit}/tsgen/string.test.ts | 4 +- tests/{ => unit}/tsgen/taxonomies.ct.js | 0 tests/{ => unit}/tsgen/taxonomies.test.ts | 4 +- 30 files changed, 636 insertions(+), 28 deletions(-) create mode 100644 tests/integration/generateTS/generateTS.test.ts create mode 100644 tests/integration/graphqlTS/graphqlTS.test.ts rename tests/{ => unit}/tsgen/boolean.ct.js (100%) rename tests/{ => unit}/tsgen/boolean.test.ts (83%) rename tests/{ => unit}/tsgen/defaults.ct.js (100%) rename tests/{ => unit}/tsgen/defaults.test.ts (89%) rename tests/{ => unit}/tsgen/global.fields.ct.js (100%) rename tests/{ => unit}/tsgen/global.fields.test.ts (87%) rename tests/{ => unit}/tsgen/group.ct.js (100%) rename tests/{ => unit}/tsgen/group.test.ts (89%) rename tests/{ => unit}/tsgen/initialization.ct.js (100%) rename tests/{ => unit}/tsgen/initialization.test.ts (84%) rename tests/{ => unit}/tsgen/isodate.ct.js (100%) rename tests/{ => unit}/tsgen/isodate.test.ts (87%) rename tests/{ => unit}/tsgen/jsdoc.ct.js (100%) rename tests/{ => unit}/tsgen/jsdoc.test.ts (81%) rename tests/{ => unit}/tsgen/modular.blocks.ct.js (100%) rename tests/{ => unit}/tsgen/modular.blocks.test.ts (89%) rename tests/{ => unit}/tsgen/number.ct.js (100%) rename tests/{ => unit}/tsgen/number.test.ts (87%) rename tests/{ => unit}/tsgen/options.ct.js (100%) rename tests/{ => unit}/tsgen/options.test.ts (82%) rename tests/{ => unit}/tsgen/references.ct.js (100%) rename tests/{ => unit}/tsgen/references.test.ts (85%) rename tests/{ => unit}/tsgen/select.ct.js (100%) rename tests/{ => unit}/tsgen/select.test.ts (88%) rename tests/{ => unit}/tsgen/string.ct.js (100%) rename tests/{ => unit}/tsgen/string.test.ts (84%) rename tests/{ => unit}/tsgen/taxonomies.ct.js (100%) rename tests/{ => unit}/tsgen/taxonomies.test.ts (85%) diff --git a/tests/integration/generateTS/generateTS.test.ts b/tests/integration/generateTS/generateTS.test.ts new file mode 100644 index 0000000..ef8b818 --- /dev/null +++ b/tests/integration/generateTS/generateTS.test.ts @@ -0,0 +1,389 @@ +import { generateTS } from "../../../src/generateTS/index"; +import { contentTypes, globalFields } from "../mock"; +import nock from "nock"; + +type RegionUrlMap = { + [prop: string]: string; +}; + +const REGION_URL_MAPPING: RegionUrlMap = { + US: "https://cdn.contentstack.io", + EU: "https://eu-cdn.contentstack.com", + AZURE_NA: "https://azure-na-cdn.contentstack.com", + AZURE_EU: "https://azure-eu-cdn.contentstack.com", + GCP_NA: "https://gcp-na-cdn.contentstack.com", +}; + +describe("generateTS function", () => { + beforeEach(() => { + jest.clearAllMocks(); + }); + + it("generates type definitions", async () => { + const token = "valid-token"; + const apiKey = "your-api-key"; + const environment = "development"; + const region = "US"; + const tokenType = "delivery"; + const branch = "main"; + + nock(REGION_URL_MAPPING[region]) + .get(`/v3/content_types/?environment=${environment}`) + .reply(200, contentTypes); + + nock(REGION_URL_MAPPING[region]) + .get("/v3/global_fields?include_branch=false") + .reply(200, globalFields); + + const generatedTS = await generateTS({ + token, + apiKey, + environment, + region, + tokenType, + branch, + }); + + expect(generatedTS).toEqual(expect.stringContaining("interface")); // Check for Output is not undefined + expect(generatedTS).toEqual(expect.stringContaining("Dishes")); // Check for whether typeDef of Content type is included + expect(generatedTS).toEqual(expect.stringContaining("Seo")); // Check for whether typeDef of Global Fields is included + expect(generatedTS).toMatch(/\/\*\*.*\*\/\n\s*(export)/); // Check for is Documentation Generated + }); + + it("generates type definitions without Documentation", async () => { + const token = "valid-token"; + const apiKey = "your-api-key"; + const environment = "development"; + const region = "US"; + const tokenType = "delivery"; + const includeDocumentation = false; + + nock(REGION_URL_MAPPING[region]) + .get(`/v3/content_types/?environment=${environment}`) + .reply(200, contentTypes); + + nock(REGION_URL_MAPPING[region]) + .get("/v3/global_fields?include_branch=false") + .reply(200, globalFields); + + const generatedTS = await generateTS({ + token, + apiKey, + environment, + region, + tokenType, + includeDocumentation, + }); + + expect(generatedTS).toEqual(expect.stringContaining("interface")); // Check for Output is not undefined + expect(generatedTS).toEqual(expect.stringContaining("Dishes")); // Check for whether typeDef of Content type is included + expect(generatedTS).toEqual(expect.stringContaining("Seo")); // Check for whether typeDef of Global Fields is included + expect(generatedTS).not.toMatch(/\/\*\*.*\*\/\n\s*(export)/); // Check for No Documentation is generated + }); + + it("generates type definitions with prefix", async () => { + const token = "valid-token"; + const apiKey = "your-api-key"; + const environment = "development"; + const region = "US"; + const tokenType = "delivery"; + const prefix = "test"; + + nock(REGION_URL_MAPPING[region]) + .get(`/v3/content_types/?environment=${environment}`) + .reply(200, contentTypes); + + nock(REGION_URL_MAPPING[region]) + .get("/v3/global_fields?include_branch=false") + .reply(200, globalFields); + + const generatedTS = await generateTS({ + token, + apiKey, + environment, + region, + tokenType, + prefix, + }); + + expect(generatedTS).toEqual(expect.stringContaining("interface")); // Check for Output is not undefined + expect(generatedTS).toMatch(/(?!Dishes)testDishes/); // Check for whether typeDef of Content type is included with test prefix + expect(generatedTS).toMatch(/(?!Seo)testSeo/); // Check for whether typeDef of Global Fields is included with test prefix + expect(generatedTS).toMatch(/\/\*\*.*\*\/\n\s*(export)/); // Check for Documentation is generated + }); + + it("generates type definitions with system fields", async () => { + const token = "valid-token"; + const apiKey = "your-api-key"; + const environment = "development"; + const region = "US"; + const tokenType = "delivery"; + const systemFields = true; + + nock(REGION_URL_MAPPING[region]) + .get(`/v3/content_types/?environment=${environment}`) + .reply(200, contentTypes); + + nock(REGION_URL_MAPPING[region]) + .get("/v3/global_fields?include_branch=false") + .reply(200, globalFields); + + const generatedTS = await generateTS({ + token, + apiKey, + environment, + region, + tokenType, + systemFields, + }); + + expect(generatedTS).toEqual(expect.stringContaining("interface")); // Check for Output is not undefined + expect(generatedTS).toMatch(/Dishes/); // Check for whether typeDef of Content type is included + expect(generatedTS).toMatch(/Seo/); // Check for whether typeDef of Global Fields is included + expect(generatedTS).toMatch(/export interface SystemFields \{\n/); // Check for whether System Fields are Created + expect(generatedTS).toMatch(/extends SystemFields \{\n/); // Check for whether interfaces have extended system fields interface + expect(generatedTS).toMatch(/\/\*\*.*\*\/\n\s*(export)/); // Check for Documentation is generated + }); +}); + +describe("generateTS function with errors", () => { + beforeEach(() => { + jest.clearAllMocks(); + }); + + it("Check for if all the required fields are provided", async () => { + const token = ""; + const apiKey = "your-api-key"; + const environment = "development"; + const region = "US"; + const tokenType = "delivery"; + const branch = "main"; + + try { + await generateTS({ + token, + apiKey, + environment, + region, + tokenType, + branch, + }); + } catch (err: any) { + expect(err.error_message).toEqual( + "Please provide all the required params (token, tokenType, apiKey, environment, region)" + ); + } + }); + + it("Check for Invalid region", async () => { + const token = "your-token"; + const apiKey = "your-api-key"; + const environment = "development"; + const region = "demo" as unknown as any; + const tokenType = "delivery"; + const branch = "main"; + + try { + await generateTS({ + token, + apiKey, + environment, + region, + tokenType, + branch, + }); + } catch (err: any) { + expect(err.error_message).toEqual( + "Please provide a valid region, supported regions are : (US, EU, AZURE_NA, AZURE_EU, GCP_NA)" + ); + } + }); + + it("Check for empty content-type response", async () => { + const token = "your-token"; + const apiKey = "your-api-key"; + const environment = "development"; + const region = "US"; + const tokenType = "delivery"; + const branch = "main"; + + nock(REGION_URL_MAPPING[region]) + .get(`/v3/content_types/?environment=${environment}`) + .reply(200, { content_types: [] }); + + try { + await generateTS({ + token, + apiKey, + environment, + region, + tokenType, + branch, + }); + } catch (err: any) { + expect(err.error_message).toEqual( + "There are no Content Types in the Stack, please create Content Models to generate type definitions" + ); + } + }); + + it("Check for invalid api_key", async () => { + const token = "your-token"; + const apiKey = "your-api-key"; + const environment = "development"; + const region = "GCP_NA"; + const tokenType = "delivery"; + const branch = "main"; + + nock(REGION_URL_MAPPING[region]) + .get(`/v3/content_types/?environment=${environment}`) + .reply(401); + + try { + await generateTS({ + token, + apiKey, + environment, + region, + tokenType, + branch, + }); + } catch (err: any) { + expect(err.error_message).toEqual( + "Unauthorized: The apiKey, token or region is not valid." + ); + } + }); + + it("Check for invalid delivery token", async () => { + const token = "your-token"; + const apiKey = "your-api-key"; + const environment = "development"; + const region = "AZURE_EU"; + const tokenType = "delivery"; + const branch = "main"; + + nock(REGION_URL_MAPPING[region]) + .get(`/v3/content_types/?environment=${environment}`) + .reply(412); + + try { + await generateTS({ + token, + apiKey, + environment, + region, + tokenType, + branch, + }); + } catch (err: any) { + expect(err.error_message).toEqual( + "Invalid Credentials: Please check the provided apiKey, token and region." + ); + } + }); + + it("Check for default error", async () => { + const token = "your-token"; + const apiKey = "your-api-key"; + const environment = "development"; + const region = "AZURE_NA"; + const tokenType = "delivery"; + const branch = "mai"; + + nock(REGION_URL_MAPPING[region]) + .get(`/v3/content_types/?environment=${environment}`) + .reply(422, { + error_message: + "Access denied. You have insufficient permissions to perform operation on this branch 'mai'.", + error_code: 901, + }); + + try { + await generateTS({ + token, + apiKey, + environment, + region, + tokenType, + branch, + }); + } catch (err: any) { + expect(err.error_message).toEqual( + "Something went wrong, Access denied. You have insufficient permissions to perform operation on this branch 'mai'." + ); + } + }); + + it("Check for TSGEN factory error", async () => { + const token = "your-token"; + const apiKey = "your-api-key"; + const environment = "development"; + const region = "EU"; + const tokenType = "delivery"; + const branch = "main"; + + nock(REGION_URL_MAPPING[region]) + .get(`/v3/content_types/?environment=${environment}`) + .reply(200, contentTypes); + + nock(REGION_URL_MAPPING[region]) + .get("/v3/global_fields?include_branch=false") + .reply(200, { global_fields: [] }); + + try { + await generateTS({ + token, + apiKey, + environment, + region, + tokenType, + branch, + }); + } catch (err: any) { + expect(err.error_message).toEqual( + "Something went wrong, Schema not found for global field 'global_field. Did you forget to include it?" + ); + } + }); + + it("Check for global fields error", async () => { + const token = "your-token"; + const apiKey = "your-api-key"; + const environment = "development"; + const region = "US"; + const tokenType = "delivery"; + const branch = "main"; + + nock(REGION_URL_MAPPING[region]) + .get(`/v3/content_types/?environment=${environment}`) + .reply(200, contentTypes); + + nock(REGION_URL_MAPPING[region]) + .get("/v3/global_fields?include_branch=false") + .reply(401); + + try { + await generateTS({ + token, + apiKey, + environment, + region, + tokenType, + branch, + }); + } catch (err: any) { + expect(err.error_message).toEqual( + "Unauthorized: The apiKey, token or region is not valid." + ); + } + }); +}); + +afterAll(() => { + nock.restore(); +}); + +afterEach(() => { + nock.cleanAll(); +}); diff --git a/tests/integration/graphqlTS/graphqlTS.test.ts b/tests/integration/graphqlTS/graphqlTS.test.ts new file mode 100644 index 0000000..725f59c --- /dev/null +++ b/tests/integration/graphqlTS/graphqlTS.test.ts @@ -0,0 +1,219 @@ +import { graphqlTS } from "../../../src/graphqlTS/index"; +import nock from "nock"; +import { graphql, invalid_graphql } from "../mock"; + +type RegionUrlMap = { + [prop: string]: string; +}; + +const GRAPHQL_REGION_URL_MAPPING: RegionUrlMap = { + US: "https://graphql.contentstack.com/stacks", + EU: "https://eu-graphql.contentstack.com/stacks", + AZURE_NA: "https://azure-na-graphql.contentstack.com/stacks", + AZURE_EU: "https://azure-eu-graphql.contentstack.com/stacks", + GCP_NA: "https://gcp-na-graphql.contentstack.com/stacks", + "wrong-region": "https://demo.com", +}; + +describe("graphqlTS function", () => { + beforeEach(() => { + jest.clearAllMocks(); + }); + + it("generates graphQL typeDef without namespace", async () => { + const token = "my-token"; + const apiKey = "my-api-key"; + const environment = "development"; + const region = "US"; + const branch = "main"; + + nock(GRAPHQL_REGION_URL_MAPPING[region]) + .post(`/${apiKey}?environment=${environment}`) + .reply(200, graphql); + + const generatedGraphql = await graphqlTS({ + token, + apiKey, + environment, + region, + branch, + }); + + expect(generatedGraphql).toMatch(/interface IAllDishes {/); + }); + + it("generates graphQL typeDef with namespace", async () => { + const token = "my-token"; + const apiKey = "my-api-key"; + const environment = "development"; + const region = "US"; + const branch = "main"; + const namespace = "demo"; + + nock(GRAPHQL_REGION_URL_MAPPING[region]) + .post(`/${apiKey}?environment=${environment}`) + .reply(200, graphql); + + const generatedGraphql = await graphqlTS({ + token, + apiKey, + environment, + region, + branch, + namespace, + }); + + expect(generatedGraphql).toMatch(/declare namespace demo {/); + }); +}); + +describe("graphqlTS function with errors", () => { + beforeEach(() => { + jest.clearAllMocks(); + }); + + it("check for whether all the required params are provided", async () => { + const token = ""; + const apiKey = "my-api-key"; + const environment = "development"; + const region = "US"; + const branch = "main"; + + try { + await graphqlTS({ + token, + apiKey, + environment, + region, + branch, + }); + } catch (err: any) { + expect(err.error_message).toEqual( + "Please provide all the required params (token, apiKey, environment, region)" + ); + } + }); + + it("check for if wrong apiKey, token and environment is provided", async () => { + const token = "my-token"; + const apiKey = "my-api-key"; + const environment = "development"; + const region = "US"; + const branch = "main"; + + nock(GRAPHQL_REGION_URL_MAPPING[region]) + .post(`/${apiKey}?environment=${environment}`) + .reply(401); + + try { + await graphqlTS({ + token, + apiKey, + environment, + region, + branch, + }); + } catch (err: any) { + expect(err.error_message).toEqual( + "Unauthorized: The apiKey, token or environment is not valid." + ); + } + }); + + it("check for if wrong region is provided", async () => { + const token = "my-token"; + const apiKey = "my-api-key"; + const environment = "development"; + const region = "wrong-region" as unknown as any; + const branch = "main"; + + try { + await graphqlTS({ + token, + apiKey, + environment, + region, + branch, + }); + } catch (err: any) { + expect(err.error_message).toEqual( + "GraphQL content delivery api unavailable for 'wrong-region' region" + ); + } + }); + + it("check for errors from gql2ts", async () => { + const token = "my-token"; + const apiKey = "my-api-key"; + const environment = "development"; + const region = "US"; + const branch = "main"; + + nock(GRAPHQL_REGION_URL_MAPPING[region]) + .post(`/${apiKey}?environment=${environment}`) + .reply(200, invalid_graphql); + + try { + await graphqlTS({ + token, + apiKey, + environment, + region, + branch, + }); + } catch (err: any) { + expect(err.error_message).toEqual( + "Invalid or incomplete schema, unknown type: Query. Ensure that a full introspection query is used in order to build a client schema." + ); + } + }); + + it("check for graphql api errors", async () => { + const token = "my-token"; + const apiKey = "my-api-key"; + const environment = "development"; + const region = "US"; + const branch = "mai"; + + nock(GRAPHQL_REGION_URL_MAPPING[region]) + .post(`/${apiKey}?environment=${environment}`) + .reply(422, { + errors: [ + { + message: "Failed to run query.", + extensions: { + errors: [ + { + code: "INVALID_BRANCH", + message: "The queried branch 'mai' is invalid.", + details: { + hint: "The queried branch does not exist in our records. Contact your stack admin for branch name and details.", + }, + }, + ], + }, + }, + ], + }); + + try { + await graphqlTS({ + token, + apiKey, + environment, + region, + branch, + }); + } catch (err: any) { + expect(err.error_message).toEqual("The queried branch 'mai' is invalid."); + } + }); +}); + +afterAll(() => { + nock.restore(); +}); + +afterEach(() => { + nock.cleanAll(); +}); diff --git a/tests/tsgen/boolean.ct.js b/tests/unit/tsgen/boolean.ct.js similarity index 100% rename from tests/tsgen/boolean.ct.js rename to tests/unit/tsgen/boolean.ct.js diff --git a/tests/tsgen/boolean.test.ts b/tests/unit/tsgen/boolean.test.ts similarity index 83% rename from tests/tsgen/boolean.test.ts rename to tests/unit/tsgen/boolean.test.ts index 3504bb9..f0af1a0 100644 --- a/tests/tsgen/boolean.test.ts +++ b/tests/unit/tsgen/boolean.test.ts @@ -1,7 +1,7 @@ const testData = require("./boolean.ct"); -import NullDocumentationGenerator from "../../src/generateTS/docgen/nulldoc"; -import tsgenFactory from "../../src/generateTS/factory"; +import NullDocumentationGenerator from "../../../src/generateTS/docgen/nulldoc"; +import tsgenFactory from "../../../src/generateTS/factory"; const tsgen = tsgenFactory({ docgen: new NullDocumentationGenerator(), diff --git a/tests/tsgen/defaults.ct.js b/tests/unit/tsgen/defaults.ct.js similarity index 100% rename from tests/tsgen/defaults.ct.js rename to tests/unit/tsgen/defaults.ct.js diff --git a/tests/tsgen/defaults.test.ts b/tests/unit/tsgen/defaults.test.ts similarity index 89% rename from tests/tsgen/defaults.test.ts rename to tests/unit/tsgen/defaults.test.ts index 7de8e61..d4bbf09 100644 --- a/tests/tsgen/defaults.test.ts +++ b/tests/unit/tsgen/defaults.test.ts @@ -1,7 +1,7 @@ const testData = require("./defaults.ct"); -import NullDocumentationGenerator from "../../src/generateTS/docgen/nulldoc"; -import tsgenFactory from "../../src/generateTS/factory"; +import NullDocumentationGenerator from "../../../src/generateTS/docgen/nulldoc"; +import tsgenFactory from "../../../src/generateTS/factory"; const tsgen = tsgenFactory({ docgen: new NullDocumentationGenerator(), diff --git a/tests/tsgen/global.fields.ct.js b/tests/unit/tsgen/global.fields.ct.js similarity index 100% rename from tests/tsgen/global.fields.ct.js rename to tests/unit/tsgen/global.fields.ct.js diff --git a/tests/tsgen/global.fields.test.ts b/tests/unit/tsgen/global.fields.test.ts similarity index 87% rename from tests/tsgen/global.fields.test.ts rename to tests/unit/tsgen/global.fields.test.ts index 1a518df..8495e27 100644 --- a/tests/tsgen/global.fields.test.ts +++ b/tests/unit/tsgen/global.fields.test.ts @@ -1,7 +1,7 @@ const testData = require("./global.fields.ct"); -import NullDocumentationGenerator from "../../src/generateTS/docgen/nulldoc"; -import tsgenFactory from "../../src/generateTS/factory"; +import NullDocumentationGenerator from "../../../src/generateTS/docgen/nulldoc"; +import tsgenFactory from "../../../src/generateTS/factory"; const tsgen = tsgenFactory({ docgen: new NullDocumentationGenerator(), diff --git a/tests/tsgen/group.ct.js b/tests/unit/tsgen/group.ct.js similarity index 100% rename from tests/tsgen/group.ct.js rename to tests/unit/tsgen/group.ct.js diff --git a/tests/tsgen/group.test.ts b/tests/unit/tsgen/group.test.ts similarity index 89% rename from tests/tsgen/group.test.ts rename to tests/unit/tsgen/group.test.ts index 41a0c79..c518d55 100644 --- a/tests/tsgen/group.test.ts +++ b/tests/unit/tsgen/group.test.ts @@ -1,7 +1,7 @@ const testData = require("./group.ct"); -import NullDocumentationGenerator from "../../src/generateTS/docgen/nulldoc"; -import tsgenFactory from "../../src/generateTS/factory"; +import NullDocumentationGenerator from "../../../src/generateTS/docgen/nulldoc"; +import tsgenFactory from "../../../src/generateTS/factory"; const tsgen = tsgenFactory({ docgen: new NullDocumentationGenerator(), diff --git a/tests/tsgen/initialization.ct.js b/tests/unit/tsgen/initialization.ct.js similarity index 100% rename from tests/tsgen/initialization.ct.js rename to tests/unit/tsgen/initialization.ct.js diff --git a/tests/tsgen/initialization.test.ts b/tests/unit/tsgen/initialization.test.ts similarity index 84% rename from tests/tsgen/initialization.test.ts rename to tests/unit/tsgen/initialization.test.ts index aae0f59..1b733b8 100644 --- a/tests/tsgen/initialization.test.ts +++ b/tests/unit/tsgen/initialization.test.ts @@ -1,7 +1,7 @@ const testData = require("./initialization.ct"); -import NullDocumentationGenerator from "../../src/generateTS/docgen/nulldoc"; -import tsgenFactory from "../../src/generateTS/factory"; +import NullDocumentationGenerator from "../../../src/generateTS/docgen/nulldoc"; +import tsgenFactory from "../../../src/generateTS/factory"; describe("initialization", () => { test("default naming convention", () => { diff --git a/tests/tsgen/isodate.ct.js b/tests/unit/tsgen/isodate.ct.js similarity index 100% rename from tests/tsgen/isodate.ct.js rename to tests/unit/tsgen/isodate.ct.js diff --git a/tests/tsgen/isodate.test.ts b/tests/unit/tsgen/isodate.test.ts similarity index 87% rename from tests/tsgen/isodate.test.ts rename to tests/unit/tsgen/isodate.test.ts index 4cc8500..761031d 100644 --- a/tests/tsgen/isodate.test.ts +++ b/tests/unit/tsgen/isodate.test.ts @@ -1,7 +1,7 @@ const testData = require("./isodate.ct"); -import NullDocumentationGenerator from "../../src/generateTS/docgen/nulldoc"; -import tsgenFactory from "../../src/generateTS/factory"; +import NullDocumentationGenerator from "../../../src/generateTS/docgen/nulldoc"; +import tsgenFactory from "../../../src/generateTS/factory"; const tsgen = tsgenFactory({ docgen: new NullDocumentationGenerator(), diff --git a/tests/tsgen/jsdoc.ct.js b/tests/unit/tsgen/jsdoc.ct.js similarity index 100% rename from tests/tsgen/jsdoc.ct.js rename to tests/unit/tsgen/jsdoc.ct.js diff --git a/tests/tsgen/jsdoc.test.ts b/tests/unit/tsgen/jsdoc.test.ts similarity index 81% rename from tests/tsgen/jsdoc.test.ts rename to tests/unit/tsgen/jsdoc.test.ts index 90ded07..5ccd431 100644 --- a/tests/tsgen/jsdoc.test.ts +++ b/tests/unit/tsgen/jsdoc.test.ts @@ -1,7 +1,7 @@ const testData = require("./jsdoc.ct"); -import JSDocumentationGenerator from "../../src/generateTS/docgen/jsdoc"; -import tsgenFactory from "../../src/generateTS/factory"; +import JSDocumentationGenerator from "../../../src/generateTS/docgen/jsdoc"; +import tsgenFactory from "../../../src/generateTS/factory"; const tsgen = tsgenFactory({ docgen: new JSDocumentationGenerator(), diff --git a/tests/tsgen/modular.blocks.ct.js b/tests/unit/tsgen/modular.blocks.ct.js similarity index 100% rename from tests/tsgen/modular.blocks.ct.js rename to tests/unit/tsgen/modular.blocks.ct.js diff --git a/tests/tsgen/modular.blocks.test.ts b/tests/unit/tsgen/modular.blocks.test.ts similarity index 89% rename from tests/tsgen/modular.blocks.test.ts rename to tests/unit/tsgen/modular.blocks.test.ts index fd44770..6414b55 100644 --- a/tests/tsgen/modular.blocks.test.ts +++ b/tests/unit/tsgen/modular.blocks.test.ts @@ -1,7 +1,7 @@ const testData = require("./modular.blocks.ct"); -import NullDocumentationGenerator from "../../src/generateTS/docgen/nulldoc"; -import tsgenFactory from "../../src/generateTS/factory"; +import NullDocumentationGenerator from "../../../src/generateTS/docgen/nulldoc"; +import tsgenFactory from "../../../src/generateTS/factory"; const tsgen = tsgenFactory({ docgen: new NullDocumentationGenerator(), diff --git a/tests/tsgen/number.ct.js b/tests/unit/tsgen/number.ct.js similarity index 100% rename from tests/tsgen/number.ct.js rename to tests/unit/tsgen/number.ct.js diff --git a/tests/tsgen/number.test.ts b/tests/unit/tsgen/number.test.ts similarity index 87% rename from tests/tsgen/number.test.ts rename to tests/unit/tsgen/number.test.ts index 31449a5..a64af91 100644 --- a/tests/tsgen/number.test.ts +++ b/tests/unit/tsgen/number.test.ts @@ -1,7 +1,7 @@ const testData = require("./number.ct"); -import NullDocumentationGenerator from "../../src/generateTS/docgen/nulldoc"; -import tsgenFactory from "../../src/generateTS/factory"; +import NullDocumentationGenerator from "../../../src/generateTS/docgen/nulldoc"; +import tsgenFactory from "../../../src/generateTS/factory"; const tsgen = tsgenFactory({ docgen: new NullDocumentationGenerator(), diff --git a/tests/tsgen/options.ct.js b/tests/unit/tsgen/options.ct.js similarity index 100% rename from tests/tsgen/options.ct.js rename to tests/unit/tsgen/options.ct.js diff --git a/tests/tsgen/options.test.ts b/tests/unit/tsgen/options.test.ts similarity index 82% rename from tests/tsgen/options.test.ts rename to tests/unit/tsgen/options.test.ts index fe832b4..fd1761c 100644 --- a/tests/tsgen/options.test.ts +++ b/tests/unit/tsgen/options.test.ts @@ -1,7 +1,7 @@ const testData = require("./options.ct"); -import NullDocumentationGenerator from "../../src/generateTS/docgen/nulldoc"; -import tsgenFactory from "../../src/generateTS/factory"; +import NullDocumentationGenerator from "../../../src/generateTS/docgen/nulldoc"; +import tsgenFactory from "../../../src/generateTS/factory"; const tsgen = tsgenFactory({ docgen: new NullDocumentationGenerator(), diff --git a/tests/tsgen/references.ct.js b/tests/unit/tsgen/references.ct.js similarity index 100% rename from tests/tsgen/references.ct.js rename to tests/unit/tsgen/references.ct.js diff --git a/tests/tsgen/references.test.ts b/tests/unit/tsgen/references.test.ts similarity index 85% rename from tests/tsgen/references.test.ts rename to tests/unit/tsgen/references.test.ts index 8d725cc..3500bb4 100644 --- a/tests/tsgen/references.test.ts +++ b/tests/unit/tsgen/references.test.ts @@ -1,7 +1,7 @@ const testData = require("./references.ct"); -import NullDocumentationGenerator from "../../src/generateTS/docgen/nulldoc"; -import tsgenFactory from "../../src/generateTS/factory"; +import NullDocumentationGenerator from "../../../src/generateTS/docgen/nulldoc"; +import tsgenFactory from "../../../src/generateTS/factory"; const tsgen = tsgenFactory({ docgen: new NullDocumentationGenerator(), diff --git a/tests/tsgen/select.ct.js b/tests/unit/tsgen/select.ct.js similarity index 100% rename from tests/tsgen/select.ct.js rename to tests/unit/tsgen/select.ct.js diff --git a/tests/tsgen/select.test.ts b/tests/unit/tsgen/select.test.ts similarity index 88% rename from tests/tsgen/select.test.ts rename to tests/unit/tsgen/select.test.ts index fc55726..866c3a8 100644 --- a/tests/tsgen/select.test.ts +++ b/tests/unit/tsgen/select.test.ts @@ -1,7 +1,7 @@ const testData = require("./select.ct"); -import NullDocumentationGenerator from "../../src/generateTS/docgen/nulldoc"; -import tsgenFactory from "../../src/generateTS/factory"; +import NullDocumentationGenerator from "../../../src/generateTS/docgen/nulldoc"; +import tsgenFactory from "../../../src/generateTS/factory"; const tsgen = tsgenFactory({ docgen: new NullDocumentationGenerator(), diff --git a/tests/tsgen/string.ct.js b/tests/unit/tsgen/string.ct.js similarity index 100% rename from tests/tsgen/string.ct.js rename to tests/unit/tsgen/string.ct.js diff --git a/tests/tsgen/string.test.ts b/tests/unit/tsgen/string.test.ts similarity index 84% rename from tests/tsgen/string.test.ts rename to tests/unit/tsgen/string.test.ts index 1856bbf..000560c 100644 --- a/tests/tsgen/string.test.ts +++ b/tests/unit/tsgen/string.test.ts @@ -1,7 +1,7 @@ const testData = require("./string.ct"); -import NullDocumentationGenerator from "../../src/generateTS/docgen/nulldoc"; -import tsgenFactory from "../../src/generateTS/factory"; +import NullDocumentationGenerator from "../../../src/generateTS/docgen/nulldoc"; +import tsgenFactory from "../../../src/generateTS/factory"; const tsgen = tsgenFactory({ docgen: new NullDocumentationGenerator(), diff --git a/tests/tsgen/taxonomies.ct.js b/tests/unit/tsgen/taxonomies.ct.js similarity index 100% rename from tests/tsgen/taxonomies.ct.js rename to tests/unit/tsgen/taxonomies.ct.js diff --git a/tests/tsgen/taxonomies.test.ts b/tests/unit/tsgen/taxonomies.test.ts similarity index 85% rename from tests/tsgen/taxonomies.test.ts rename to tests/unit/tsgen/taxonomies.test.ts index d095a8c..eefe5de 100644 --- a/tests/tsgen/taxonomies.test.ts +++ b/tests/unit/tsgen/taxonomies.test.ts @@ -1,7 +1,7 @@ const testData = require("./taxonomies.ct"); -import NullDocumentationGenerator from "../../src/generateTS/docgen/nulldoc"; -import tsgenFactory from "../../src/generateTS/factory"; +import NullDocumentationGenerator from "../../../src/generateTS/docgen/nulldoc"; +import tsgenFactory from "../../../src/generateTS/factory"; const tsgen = tsgenFactory({ docgen: new NullDocumentationGenerator(),