UNPKG

@kintone/dts-gen

Version:

Types for kintone js api and Types generating tools

65 lines 1.93 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const typedefinitions_1 = require("./typedefinitions"); const fields_1 = require("./fields"); describe("TypeDefinition", () => { class TestFieldGroup extends fields_1.FieldGroup { constructor() { super(null, null, null, null, null); } tsExpression() { return "// FieldGroup"; } } class TestSubTableField extends fields_1.SubTableField { constructor() { super(null, null, null); } tsExpression() { return "// SubTableField"; } } test("tsExpression()", () => { expect(new typedefinitions_1.TypeDefinition("TestType", new TestFieldGroup(), [ new TestSubTableField(), new TestSubTableField(), ]) .tsExpression() .trim()).toEqual(` interface TestType { // FieldGroup // SubTableField // SubTableField }`.trim()); }); }); describe("SavedTypeDefinition", () => { class TestStringFieldInSavedRecord extends fields_1.TsDefinedField { constructor() { super(null, null); } tsExpression() { return "// StringFieldInSavedRecord"; } } class TestUserField extends fields_1.TsDefinedField { constructor() { super(null, null); } tsExpression() { return "// UserField"; } } test("tsExpression()", () => { expect(new typedefinitions_1.SavedTypeDefinition("TestType", [new TestUserField()], [new TestStringFieldInSavedRecord()]) .tsExpression() .trim()).toEqual(` interface SavedTestType extends TestType { $id : kintone.fieldTypes.Id; $revision: kintone.fieldTypes.Revision; // UserField // StringFieldInSavedRecord }`.trim()); }); }); //# sourceMappingURL=typedefinitions.test.js.map