Skip to content

Commit

Permalink
test: Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
liqueurdetoile committed Mar 26, 2019
1 parent 681c11b commit 35ba239
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tests/core.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import MockServer from '@';
import Server from '@';

let response, data;

describe('Mock Server core functionalities testing suite', function () {
let server = new MockServer();
const server = new Server();

beforeEach(() => server.start());
afterEach(() => {
Expand Down
4 changes: 1 addition & 3 deletions tests/fixtures.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {Server} from '@';
import server from './server';
import PouchDB from 'pouchdb';

describe('Fixtures testing suite', function() {
let server = new Server();

beforeEach(() => server.start());
afterEach(() => {
server.stop();
Expand Down
9 changes: 9 additions & 0 deletions tests/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Server from '@';

const server = new Server();

server._getFixtureParams = function() {
return require(`fixtures/${this.fixture}.fixture.js`).default;
}

export default server;
10 changes: 5 additions & 5 deletions tests/wrapper.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import MockServer from '@';
import Server from '@';

describe('Wrapper option testing suite', function () {
it('should wrap response with default slot', async function () {
let server = new MockServer({
let server = new Server({
wrapper: '<h1>A good wrapper for %data%</h1>'
});

Expand All @@ -17,7 +17,7 @@ describe('Wrapper option testing suite', function () {
});

it('should wrap response with named slots', async function () {
let server = new MockServer({
let server = new Server({
wrapper: '<h1>A good wrapper for %title%</h1><h2>And for %subtitle% subtitle</h2>'
});

Expand All @@ -34,7 +34,7 @@ describe('Wrapper option testing suite', function () {
});

it('should wrap response with JSON data', async function () {
let server = new MockServer({
let server = new Server({
wrapper: `{
"success":true,
"data":%data%
Expand All @@ -52,7 +52,7 @@ describe('Wrapper option testing suite', function () {
});

it('should use a callback function as wrapper', async function() {
let server = new MockServer();
let server = new Server();

server.wrapper = data => JSON.stringify({success:true, data})

Expand Down

0 comments on commit 35ba239

Please sign in to comment.