Skip to content

Commit 3b9a686

Browse files
authored
Merge pull request #1212 from jembi/hotfix
Hotfix
2 parents 69e71eb + 130d8bc commit 3b9a686

File tree

4 files changed

+62
-5
lines changed

4 files changed

+62
-5
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "openhim-core",
33
"description": "The OpenHIM core application that provides logging and routing of http requests",
4-
"version": "8.3.0",
4+
"version": "8.3.1",
55
"main": "./lib/server.js",
66
"bin": {
77
"openhim-core": "./bin/openhim-core.js"

src/model/apps.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ const AppSchema = new Schema({
1111
required: true
1212
},
1313
description: String,
14-
icon: {
15-
data: Buffer,
16-
contentType: String
14+
icon: String,
15+
type: {
16+
type: String,
17+
enum: ['link', 'embedded']
1718
},
1819
category: String,
1920
access_roles: [String],

test/integration/appsAPITests.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('API Integration Tests', () => {
2020
name: 'Test app',
2121
description: 'An app for testing the app framework',
2222
icon: 'data:image/png;base64, <base64>',
23-
type: 'link|embedded',
23+
type: 'link',
2424
category: 'Operations',
2525
access_roles: ['test-app-user'],
2626
url: 'http://test-app.org/app',

test/unit/appsTest.js

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
'use strict'
2+
3+
/* eslint-env mocha */
4+
import should from 'should'
5+
6+
import {getApps, updateApp} from '../../src/api/apps'
7+
import {AppModelAPI} from '../../src/model/apps'
8+
9+
describe('Apps', () => {
10+
afterEach(async () => {
11+
await AppModelAPI.deleteMany({})
12+
})
13+
14+
describe('getApps', () => {
15+
it('should fail when retrieving from mongo fails', async () => {
16+
const ctx = {
17+
request: {
18+
query: {}
19+
}
20+
}
21+
22+
await getApps(ctx)
23+
24+
ctx.status.should.equal(500)
25+
should.exist(ctx.body.error)
26+
})
27+
})
28+
29+
describe('updateApps', () => {
30+
it('should fail when updating in mongo fails', async () => {
31+
const app = AppModelAPI({
32+
name: 'Test app1',
33+
description: 'An app for testing the app framework',
34+
icon: 'data:image/png;base64, <base64>',
35+
type: 'link',
36+
category: 'Operations',
37+
access_roles: ['test-app-user'],
38+
url: 'http://test-app.org/app1',
39+
showInPortal: true,
40+
showInSideBar: true
41+
})
42+
await app.save()
43+
44+
const ctx = {
45+
request: {
46+
body: {}
47+
},
48+
status: 200
49+
}
50+
51+
await updateApp(ctx, app._id)
52+
53+
should.exist(ctx.body.error)
54+
})
55+
})
56+
})

0 commit comments

Comments
 (0)