File tree Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Original file line number Diff line number Diff line change 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+ } )
You can’t perform that action at this time.
0 commit comments