Skip to content
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.

Commit

Permalink
removed references to demo name
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Lavigne committed Sep 28, 2016
1 parent f9ef5e1 commit d0354b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
1 change: 0 additions & 1 deletion src/services/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export const callApi = (endpoint, {
export const createDemo = () =>
callApi('demos', {
method: 'POST',
body: { name: 'demo' },
});

export const getDemo = guid => callApi(`demos/${guid}`);
Expand Down
22 changes: 4 additions & 18 deletions src/services/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,25 @@ import {
} from '../services';

test('(API) createDemo', function *(t) {
t.plan(2);
t.plan(1);

const endpoint = '/demos';
const success = { id: 123, name: 'demo' };
const success = { id: 123 };

nock(controllerApi)
.post(endpoint, {
name: 'demo',
})
.post(endpoint)
.reply(200, success);

const response = yield createDemo();
t.deepEqual(response, success);

const fail = { message: 'Invalid email address' };
nock(controllerApi)
.post(endpoint, { name: 'demo' })
.reply(422, fail);

try {
yield createDemo();
}
catch (error) {
t.deepEqual(error, fail);
}
});

test('(API) getDemo', function *(t) {
t.plan(2);

const guid = '1234';
const endpoint = `/demos/${guid}`;
const success = { guid, id: 123, name: 'demo' };
const success = { guid, id: 123 };

nock(controllerApi)
.get(endpoint)
Expand Down

0 comments on commit d0354b0

Please sign in to comment.