From a8918ebe0247f1dc76524c629e269849e9bb98fa Mon Sep 17 00:00:00 2001 From: Vitaly Kravtsov Date: Thu, 24 Oct 2024 20:23:16 +0600 Subject: [PATCH] test(typescript): update --- test/aidbox_sdk/generator/typescript_test.clj | 48 +++++++++++++++---- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/test/aidbox_sdk/generator/typescript_test.clj b/test/aidbox_sdk/generator/typescript_test.clj index 2b658d0..948132c 100644 --- a/test/aidbox_sdk/generator/typescript_test.clj +++ b/test/aidbox_sdk/generator/typescript_test.clj @@ -110,14 +110,22 @@ (match (str/split-lines (gen.typescript/generate-class (fixt/get-data :patient-ir-schema))) + ["export type Patient = DomainResource & {" + " resourceType: 'Patient'" + " multipleBirthBoolean?: boolean;" + " _multipleBirthBoolean?: Element;" " address?: Address[];" + " deceasedDateTime?: string;" + " _deceasedDateTime?: Element;" " managingOrganization?: Reference;" + " deceasedBoolean?: boolean;" + " _deceasedBoolean?: Element;" " name?: HumanName[];" " birthDate?: string;" " _birthDate?: Element;" - " multipleBirth?: boolean | number;" - " deceased?: string | boolean;" + " multipleBirthInteger?: number;" + " _multipleBirthInteger?: Element;" " photo?: Attachment[];" " link?: PatientLink[];" " active?: boolean;" @@ -133,7 +141,9 @@ "};"])) (testing "empty elements" - (is (= "export type Base = {};" + (is (= "export type Base = { + resourceType: 'Base' +};" (gen.typescript/generate-class {:package "hl7.fhir.r5.core", :derivation nil, :type "Base", @@ -150,17 +160,21 @@ (str/split-lines (gen.typescript/generate-class (fixt/get-data :patient-ir-schema) (map gen.typescript/generate-class (:backbone-elements (fixt/get-data :patient-ir-schema))))) + ["export type PatientLink = BackboneElement & {" + " resourceType: 'PatientLink'" " type: string;" " other: Reference;" "};" "" "export type PatientCommunication = BackboneElement & {" + " resourceType: 'PatientCommunication'" " language: CodeableConcept;" " preferred?: boolean;" "};" "" "export type PatientContact = BackboneElement & {" + " resourceType: 'PatientContact'" " name?: HumanName;" " gender?: string;" " period?: Period;" @@ -171,13 +185,20 @@ "};" "" "export type Patient = DomainResource & {" + " resourceType: 'Patient'" + " multipleBirthBoolean?: boolean;" + " _multipleBirthBoolean?: Element;" " address?: Address[];" + " deceasedDateTime?: string;" + " _deceasedDateTime?: Element;" " managingOrganization?: Reference;" + " deceasedBoolean?: boolean;" + " _deceasedBoolean?: Element;" " name?: HumanName[];" " birthDate?: string;" " _birthDate?: Element;" - " multipleBirth?: boolean | number;" - " deceased?: string | boolean;" + " multipleBirthInteger?: number;" + " _multipleBirthInteger?: Element;" " photo?: Attachment[];" " link?: PatientLink[];" " active?: boolean;" @@ -202,6 +223,7 @@ (deftest test-generate-resources (match (str/split-lines (:content (sut/generate-resource-module generator (fixt/get-data :patient-ir-schema)))) + ["import { Address } from \"./Address\";" "import { Attachment } from \"./Attachment\";" "import { Period } from \"./Period\";" @@ -212,19 +234,22 @@ "import { Reference } from \"./Reference\";" "import { Identifier } from \"./Identifier\";" "import { BackboneElement } from \"./BackboneElement\";" - "import { AdministrativeGender } from \"./valuesets\"" + "import { AdministrativeGender } from './valuesets';" "" "export type PatientLink = BackboneElement & {" + " resourceType: 'PatientLink'" " type: string;" " other: Reference;" "};" "" "export type PatientCommunication = BackboneElement & {" + " resourceType: 'PatientCommunication'" " language: CodeableConcept;" " preferred?: boolean;" "};" "" "export type PatientContact = BackboneElement & {" + " resourceType: 'PatientContact'" " name?: HumanName;" " gender?: string;" " period?: Period;" @@ -235,13 +260,20 @@ "};" "" "export type Patient = DomainResource & {" + " resourceType: 'Patient'" + " multipleBirthBoolean?: boolean;" + " _multipleBirthBoolean?: Element;" " address?: Address[];" + " deceasedDateTime?: string;" + " _deceasedDateTime?: Element;" " managingOrganization?: Reference;" + " deceasedBoolean?: boolean;" + " _deceasedBoolean?: Element;" " name?: HumanName[];" " birthDate?: string;" " _birthDate?: Element;" - " multipleBirth?: boolean | number;" - " deceased?: string | boolean;" + " multipleBirthInteger?: number;" + " _multipleBirthInteger?: Element;" " photo?: Attachment[];" " link?: PatientLink[];" " active?: boolean;"