Skip to content
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
12 changes: 8 additions & 4 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,27 @@ jobs:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: ./
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: jembi/openhim-core:latest
12 changes: 8 additions & 4 deletions .github/workflows/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,30 @@ jobs:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Login to Docker Hub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: ./
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: jembi/openhim-core:${{ env.RELEASE_VERSION }}
6 changes: 6 additions & 0 deletions .nycrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"all": true,
"include": [
"src/**"
]
}
18 changes: 18 additions & 0 deletions test/unit/messageStoreTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ describe('MessageStore', () => {
})
})

it('should fail to save invalid transaction', done => {
ctx.authorisedChannel._id = 'Invalid_ID'

messageStore.storeTransaction(ctx, (error) => {
error.message.should.match(/Transaction validation failed/)
return done()
})
})

it('should be able to save the transaction if the headers contain Mongo reserved characters ($ or .)', done => {
ctx.header['dot.header'] = '123'
ctx.header.dollar$header = '124'
Expand Down Expand Up @@ -244,6 +253,15 @@ describe('MessageStore', () => {
})
})

it('should fail to update a transactionthat does not exist', done => {
ctx.response = createResponse(201)
ctx.transactionId = 'Invalid_ID'
messageStore.storeResponse(ctx, err => {
err.message.should.match(/Cast to ObjectId failed/)
return done()
})
})

it('should update the transaction with the responses from non-primary routes', done => {
ctx.response = createResponse(201)
const route = createRoute('route1', 200)
Expand Down