Skip to content

Commit

Permalink
A little format change in test
Browse files Browse the repository at this point in the history
  • Loading branch information
hzalaz committed Feb 23, 2017
1 parent 8a2973c commit 215ed2b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/__tests__/core/tenant.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,28 @@ const runTest = (initTenant, mockDataFns, client) => {
describe('initTenant()', () => {
let initTenant;
let mockDataFns;

beforeEach(() => {
jest.resetModules();

mockDataFns = {
initNS: jest.fn(),
get: jest.fn()
};

jest.mock('utils/data_utils', () => ({
dataFns: () => mockDataFns
}));

jest.mock('core/index', () => ({
findConnection: jest.fn()
}));

initTenant = getInitTenant();
});

describe('with database connection', () => {

it('maps connection correctly with defaults', () => {
const client = {
connections: {
Expand All @@ -40,6 +45,7 @@ describe('initTenant()', () => {
};
runTest(initTenant, mockDataFns, client);
});

it('maps connection correctly with all the properties', () => {
const client = {
connections: {
Expand All @@ -61,6 +67,7 @@ describe('initTenant()', () => {
};
runTest(initTenant, mockDataFns, client);
});

it('fixes validation when values are not numbers', () => {
const client = {
connections: {
Expand All @@ -82,6 +89,7 @@ describe('initTenant()', () => {
};
runTest(initTenant, mockDataFns, client);
});

it('fixes validation when username.min > username.max', () => {
const client = {
connections: {
Expand All @@ -104,6 +112,7 @@ describe('initTenant()', () => {
runTest(initTenant, mockDataFns, client);
});
});

describe('with enterprise connection', () => {
it('maps connection correctly', () => {
const client = {
Expand All @@ -118,6 +127,7 @@ describe('initTenant()', () => {
runTest(initTenant, mockDataFns, client);
});
});

describe('with other connection types', () => {
it('maps connection correctly', () => {
const client = {
Expand All @@ -135,6 +145,7 @@ describe('initTenant()', () => {
runTest(initTenant, mockDataFns, client);
});
});

describe('with passwordless connection', () => {
it('maps connection correctly', () => {
const client = {
Expand All @@ -148,7 +159,8 @@ describe('initTenant()', () => {
runTest(initTenant, mockDataFns, client);
});
});
test('filters clientConnections', () => {

it('filters clientConnections', () => {
const client = {
connections: {
database: [{
Expand Down

0 comments on commit 215ed2b

Please sign in to comment.