-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
118ca21
commit 130d8bc
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}) | ||
}) | ||
}) |