Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: field.ts fix #45

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ docs
lib
.npmrc
package-lock.json
.npmrc

# Webstorm
.idea
.run
temp
1 change: 1 addition & 0 deletions __tests__/hl7.build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,7 @@ describe('node hl7 client - builder tests', () => {
expect(message.get('MSH.9.2').toString()).toBe("A01")
expect(message.get('MSH.9.3').toString()).toBe("ADT_A01")
expect(message.get('MSH.10').toString()).toBe("12345")
expect(message.get('MSH.11.1').toString()).toBe("")
expect(message.get('MSH.12').toString()).toBe("2.7")
expect(message.get('EVN.2').toString()).toBe("20081231")

Expand Down
8 changes: 4 additions & 4 deletions __tests__/hl7.end2end.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ describe('node hl7 end to end', () => {

let LISTEN_PORT: number

const hl7_string: string = "MSH|^~\\&|||||20081231||ADT^A01^ADT_A01|12345||2.7\rEVN||20081231"
const hl7_string: string = "MSH|^~\\&|||||20081231||ADT^A01^ADT_A01|12345|D|2.7\rEVN||20081231"

beforeAll(async () => {

Expand All @@ -355,7 +355,7 @@ describe('node hl7 end to end', () => {
const message = new Message({text: hl7_string, date: "8"})
message.toFile('readFileTestMSH', true, 'temp/')

await sleep(2)
await sleep(15)

})

Expand Down Expand Up @@ -383,7 +383,7 @@ describe('node hl7 end to end', () => {
expect(messageRes.get('MSA.1').toString()).toBe('AA')
})

await sleep(5)
await sleep(15)

const fileBatch = await OB_ADT.readFile(`temp/hl7.readFileTestMSH.20081231.hl7`)

Expand Down Expand Up @@ -422,7 +422,7 @@ describe('node hl7 end to end', () => {
expect(messageRes.get('MSA.1').toString()).toBe('AA')
})

await sleep(5)
await sleep(15)

const fileBatch = await OB_ADT.readFile(`temp/hl7.readFileTestMSH.20081231.hl7`)

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"clean": "rm -rf coverage docs lib temp",
"build": "tsc && tsc -p tsconfig.cjs.json && tsc -p tsconfig.types.json && ./bin/build-types.sh",
"build:watch": "tsc -w",
"lint": "ts-standard --parser @typescript-eslint/parser | snazzy",
"lint:fix": "ts-standard --fix --parser @typescript-eslint/parser | snazzy",
"lint": "ts-standard | snazzy",
"lint:fix": "ts-standard --fix | snazzy",
"pack": "npm pack",
"prepublishOnly": "npm run clean && npm run build && npm run test:ci && npm run pack",
"test": "jest",
Expand Down Expand Up @@ -67,7 +67,7 @@
"@typescript-eslint/parser": "^6.15.0",
"jest": "^29.7.0",
"jest-ts-webcompat-resolver": "^1.0.0",
"node-hl7-server": "^1.0.0-beta.4",
"node-hl7-server": "^1.0.0-beta.7",
"npm-check-updates": "^16.14.12",
"portfinder": "^1.0.32",
"pre-commit": "^1.2.2",
Expand Down
3 changes: 1 addition & 2 deletions src/builder/modules/field.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { HL7FatalError } from '../../utils/exception.js'
import { Delimiters } from '../../utils/enum.js'
import { Node } from '../interface/node.js'
import { FieldRepetition } from './fieldRepetition.js'
Expand All @@ -17,7 +16,7 @@ export class Field extends ValueNode {
if (this.children.length > 0) {
return this.children[0].read(path)
}
throw new HL7FatalError(500, 'We have a problem.')
return this
}

/** @internal */
Expand Down