Skip to content

Commit

Permalink
test: changed function names
Browse files Browse the repository at this point in the history
  • Loading branch information
osher-sade committed Jun 10, 2019
1 parent b38dbed commit 59f7fbe
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
5 changes: 3 additions & 2 deletions test/integration-tests/test-server/run-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { closeConnection, initConnection } from '@enigmatis/mongo-driver';
import { config } from 'dotenv';
import * as mongoose from 'mongoose';
import { logger, server } from './server';
export async function init() {

export async function startTestServer() {
config();
jest.setTimeout(15000);
const connectionString =
Expand All @@ -12,7 +13,7 @@ export async function init() {
server.start();
}

export async function finish() {
export async function stopTestServer() {
await closeConnection();
await server.stop();
}
6 changes: 3 additions & 3 deletions test/integration-tests/tests/irrelevant-entities.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PolarisRequestHeaders } from '@enigmatis/utills';
import { graphqlRawRequest, graphQLRequest } from '../test-server/client';
import { BookModelPerReality } from '../test-server/dal/book-model';
import { finish, init } from '../test-server/run-test';
import { startTestServer, stopTestServer } from '../test-server/run-test';
export const titles = ['first', 'second', 'third', 'fourth', 'fifth'];

const prepareDb = async (headers: PolarisRequestHeaders) => {
Expand All @@ -15,12 +15,12 @@ const prepareDb = async (headers: PolarisRequestHeaders) => {
const requestHeaders = { 'reality-id': 1, 'data-version': 1 };

beforeEach(async () => {
await init();
await startTestServer();
await prepareDb({ realityId: 1 });
});

afterEach(() => {
return finish();
return stopTestServer();
});

describe('irrelevant entities tests', () => {
Expand Down
6 changes: 3 additions & 3 deletions test/integration-tests/tests/mutation.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { graphQLRequest } from '../test-server/client';
import { finish, init } from '../test-server/run-test';
import { startTestServer, stopTestServer } from '../test-server/run-test';

const headers = { 'reality-id': 1 };
const createBookMutation = `mutation createBook ($book:BookInput!) {createBook(book:$book){testId}}`;
Expand All @@ -12,11 +12,11 @@ const deleteBookMutation = `mutation deleteBook ($bookId:String!) {
const defaultBookVariables = (title: string, testId: string) => ({ title, testId });

beforeEach(() => {
return init();
return startTestServer();
});

afterEach(() => {
return finish();
return stopTestServer();
});

describe('mutation tests', () => {
Expand Down
6 changes: 3 additions & 3 deletions test/integration-tests/tests/query.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PolarisRequestHeaders } from '@enigmatis/utills';
import { graphQLRequest } from '../test-server/client';
import { BookModelPerReality } from '../test-server/dal/book-model';
import { finish, init } from '../test-server/run-test';
import { startTestServer, stopTestServer } from '../test-server/run-test';

const titles = ['first', 'second', 'third', 'fourth', 'fifth'];

Expand All @@ -16,12 +16,12 @@ const prepareDb = async (headers: PolarisRequestHeaders) => {
const requestHeaders = { 'reality-id': 1 };

beforeEach(async () => {
await init();
await startTestServer();
await prepareDb({ realityId: 1 });
});

afterEach(() => {
return finish();
return stopTestServer();
});

describe('query tests', () => {
Expand Down
6 changes: 3 additions & 3 deletions test/integration-tests/tests/reality.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { graphQLRequest } from '../test-server/client';
import { AuthorModelPerReality } from '../test-server/dal/author-model';
import { BookModelPerReality } from '../test-server/dal/book-model';
import { finish, init } from '../test-server/run-test';
import { startTestServer, stopTestServer } from '../test-server/run-test';

const dbRealityIdHeader = (realityId: any) => ({ realityId });
const requestRealityIdHeader = (realityId: any) => ({ 'reality-id': realityId });
Expand Down Expand Up @@ -45,12 +45,12 @@ const prepareDb = async () => {
};

beforeEach(async () => {
await init();
await startTestServer();
await prepareDb();
});

afterEach(() => {
return finish();
return stopTestServer();
});

describe('reality tests', () => {
Expand Down

0 comments on commit 59f7fbe

Please sign in to comment.