Skip to content

Commit

Permalink
test: update unit testing (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bugs5382 authored Feb 4, 2024
2 parents 1dac2c1 + 5d675e4 commit 4d81313
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
22 changes: 21 additions & 1 deletion __tests__/hl7.server.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
import { describe, expect, test } from 'vitest';
import { InboundRequest, Server } from '../src'
import {HL7ListenerError, InboundRequest, Server} from '../src'

describe('node hl7 server', () => {

describe('sanity tests - modules', () => {
test('InboundRequest - message undefined', async () => {
// @ts-expect-error
const empty = new InboundRequest(undefined, { type: 'file' })
try {
empty.getMessage()
} catch (e) {
expect(e).toStrictEqual(new HL7ListenerError('Message is not defined.'))
}
})

test('InboundRequest - type check', async () => {
// @ts-expect-error
const req = new InboundRequest('', { type: 'file' })
expect(req.getType()).toBe('file')
})

})

describe('sanity tests - server class', () => {
test('error - bindAddress has to be string', async () => {
try {
Expand Down
1 change: 1 addition & 0 deletions vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default defineConfig({
coverage: {
exclude: [
'__tests__/__utils__/**',
'docker',
'bin',
'certs',
'docs',
Expand Down

0 comments on commit 4d81313

Please sign in to comment.