Skip to content

Commit

Permalink
Merge pull request #1212 from jembi/hotfix
Browse files Browse the repository at this point in the history
Hotfix
  • Loading branch information
bradsawadye authored Nov 2, 2023
2 parents 69e71eb + 130d8bc commit 3b9a686
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "openhim-core",
"description": "The OpenHIM core application that provides logging and routing of http requests",
"version": "8.3.0",
"version": "8.3.1",
"main": "./lib/server.js",
"bin": {
"openhim-core": "./bin/openhim-core.js"
Expand Down
7 changes: 4 additions & 3 deletions src/model/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ const AppSchema = new Schema({
required: true
},
description: String,
icon: {
data: Buffer,
contentType: String
icon: String,
type: {
type: String,
enum: ['link', 'embedded']
},
category: String,
access_roles: [String],
Expand Down
2 changes: 1 addition & 1 deletion test/integration/appsAPITests.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('API Integration Tests', () => {
name: 'Test app',
description: 'An app for testing the app framework',
icon: 'data:image/png;base64, <base64>',
type: 'link|embedded',
type: 'link',
category: 'Operations',
access_roles: ['test-app-user'],
url: 'http://test-app.org/app',
Expand Down
56 changes: 56 additions & 0 deletions test/unit/appsTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
'use strict'

/* eslint-env mocha */
import should from 'should'

import {getApps, updateApp} from '../../src/api/apps'
import {AppModelAPI} from '../../src/model/apps'

describe('Apps', () => {
afterEach(async () => {
await AppModelAPI.deleteMany({})
})

describe('getApps', () => {
it('should fail when retrieving from mongo fails', async () => {
const ctx = {
request: {
query: {}
}
}

await getApps(ctx)

ctx.status.should.equal(500)
should.exist(ctx.body.error)
})
})

describe('updateApps', () => {
it('should fail when updating in mongo fails', async () => {
const app = AppModelAPI({
name: 'Test app1',
description: 'An app for testing the app framework',
icon: 'data:image/png;base64, <base64>',
type: 'link',
category: 'Operations',
access_roles: ['test-app-user'],
url: 'http://test-app.org/app1',
showInPortal: true,
showInSideBar: true
})
await app.save()

const ctx = {
request: {
body: {}
},
status: 200
}

await updateApp(ctx, app._id)

should.exist(ctx.body.error)
})
})
})

0 comments on commit 3b9a686

Please sign in to comment.