Skip to content

Commit

Permalink
test(typescript): update
Browse files Browse the repository at this point in the history
  • Loading branch information
krvital committed Oct 24, 2024
1 parent ae8d186 commit a8918eb
Showing 1 changed file with 40 additions and 8 deletions.
48 changes: 40 additions & 8 deletions test/aidbox_sdk/generator/typescript_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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;"
Expand All @@ -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",
Expand All @@ -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;"
Expand All @@ -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;"
Expand All @@ -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\";"
Expand All @@ -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;"
Expand All @@ -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;"
Expand Down

0 comments on commit a8918eb

Please sign in to comment.