Skip to content

Commit

Permalink
[test] Move from 'context' to 'describe' (elastic#11013)
Browse files Browse the repository at this point in the history
  • Loading branch information
kimjoar committed Apr 4, 2017
1 parent eb40f7d commit ee2219d
Show file tree
Hide file tree
Showing 36 changed files with 136 additions and 136 deletions.
20 changes: 10 additions & 10 deletions src/cli/cluster/__tests__/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('CLI cluster manager', function () {
});

describe('#onChange', function () {
context('opts.watch = true', function () {
describe('opts.watch = true', function () {
it('restarts the fork', function () {
const worker = setup({ watch: true });
sinon.stub(worker, 'start');
Expand All @@ -54,7 +54,7 @@ describe('CLI cluster manager', function () {
});
});

context('opts.watch = false', function () {
describe('opts.watch = false', function () {
it('does not restart the fork', function () {
const worker = setup({ watch: false });
sinon.stub(worker, 'start');
Expand All @@ -66,7 +66,7 @@ describe('CLI cluster manager', function () {
});

describe('#shutdown', function () {
context('after starting()', function () {
describe('after starting()', function () {
it('kills the worker and unbinds from message, online, and disconnect events', async function () {
const worker = setup();
await worker.start();
Expand All @@ -84,7 +84,7 @@ describe('CLI cluster manager', function () {
});
});

context('before being started', function () {
describe('before being started', function () {
it('does nothing', function () {
const worker = setup();
worker.shutdown();
Expand All @@ -93,7 +93,7 @@ describe('CLI cluster manager', function () {
});

describe('#parseIncomingMessage()', function () {
context('on a started worker', function () {
describe('on a started worker', function () {
it(`is bound to fork's message event`, async function () {
const worker = setup();
await worker.start();
Expand All @@ -120,7 +120,7 @@ describe('CLI cluster manager', function () {
});

describe('#onMessage', function () {
context('when sent WORKER_BROADCAST message', function () {
describe('when sent WORKER_BROADCAST message', function () {
it('emits the data to be broadcasted', function () {
const worker = setup();
const data = {};
Expand All @@ -130,7 +130,7 @@ describe('CLI cluster manager', function () {
});
});

context('when sent WORKER_LISTENING message', function () {
describe('when sent WORKER_LISTENING message', function () {
it('sets the listening flag and emits the listening event', function () {
const worker = setup();
const stub = sinon.stub(worker, 'emit');
Expand All @@ -141,7 +141,7 @@ describe('CLI cluster manager', function () {
});
});

context('when passed an unkown message', function () {
describe('when passed an unkown message', function () {
it('does nothing', function () {
const worker = setup();
worker.onMessage('asdlfkajsdfahsdfiohuasdofihsdoif');
Expand All @@ -152,7 +152,7 @@ describe('CLI cluster manager', function () {
});

describe('#start', function () {
context('when not started', function () {
describe('when not started', function () {
it('creates a fork and waits for it to come online', async function () {
const worker = setup();

Expand All @@ -179,7 +179,7 @@ describe('CLI cluster manager', function () {
});
});

context('when already started', function () {
describe('when already started', function () {
it('calls shutdown and waits for the graceful shutdown to cause a restart', async function () {
const worker = setup();
await worker.start();
Expand Down
2 changes: 1 addition & 1 deletion src/cli/serve/__tests__/read_yaml_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('cli/serve/read_yaml_config', function () {
});
});

context('different cwd()', function () {
describe('different cwd()', function () {
const oldCwd = process.cwd();
const newCwd = join(oldCwd, '..');

Expand Down
2 changes: 1 addition & 1 deletion src/core_plugins/console/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('plugins/console', function () {
};
});

context('proxyConfig', function () {
describe('proxyConfig', function () {
it('leaves the proxyConfig settings', function () {
const proxyConfigOne = {};
const proxyConfigTwo = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('plugins/console', function () {
expect(agent).to.be.a(http.Agent);
});

context('ssl', function () {
describe('ssl', function () {
beforeEach(function () {
setElasticsearchConfig('url', 'https://localhost:9200');
});
Expand Down
24 changes: 12 additions & 12 deletions src/core_plugins/console/server/__tests__/proxy_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('ProxyConfig', function () {
});

describe('#getForParsedUri', function () {
context('parsed url does not match', function () {
describe('parsed url does not match', function () {
it('returns {}', function () {
const config = new ProxyConfig({
match: matchGoogle,
Expand All @@ -103,7 +103,7 @@ describe('ProxyConfig', function () {
});
});

context('parsed url does match', function () {
describe('parsed url does match', function () {
it('assigns timeout value', function () {
const football = {};
const config = new ProxyConfig({
Expand All @@ -126,8 +126,8 @@ describe('ProxyConfig', function () {
expect(config.getForParsedUri(parsedGoogle).rejectUnauthorized).to.be(football);
});

context('uri us http', function () {
context('ca is set', function () {
describe('uri us http', function () {
describe('ca is set', function () {
it('creates but does not output the agent', function () {
const config = new ProxyConfig({
ssl: {
Expand All @@ -139,7 +139,7 @@ describe('ProxyConfig', function () {
expect(config.getForParsedUri({ protocol: 'http:' }).agent).to.be(undefined);
});
});
context('cert is set', function () {
describe('cert is set', function () {
it('creates but does not output the agent', function () {
const config = new ProxyConfig({
ssl: {
Expand All @@ -151,7 +151,7 @@ describe('ProxyConfig', function () {
expect(config.getForParsedUri({ protocol: 'http:' }).agent).to.be(undefined);
});
});
context('key is set', function () {
describe('key is set', function () {
it('creates but does not output the agent', function () {
const config = new ProxyConfig({
ssl: {
Expand All @@ -163,7 +163,7 @@ describe('ProxyConfig', function () {
expect(config.getForParsedUri({ protocol: 'http:' }).agent).to.be(undefined);
});
});
context('cert + key are set', function () {
describe('cert + key are set', function () {
it('creates but does not output the agent', function () {
const config = new ProxyConfig({
ssl: {
Expand All @@ -178,8 +178,8 @@ describe('ProxyConfig', function () {
});
});

context('uri us https', function () {
context('ca is set', function () {
describe('uri us https', function () {
describe('ca is set', function () {
it('creates and outputs the agent', function () {
const config = new ProxyConfig({
ssl: {
Expand All @@ -191,7 +191,7 @@ describe('ProxyConfig', function () {
expect(config.getForParsedUri({ protocol: 'https:' }).agent).to.be(config.sslAgent);
});
});
context('cert is set', function () {
describe('cert is set', function () {
it('creates and outputs the agent', function () {
const config = new ProxyConfig({
ssl: {
Expand All @@ -203,7 +203,7 @@ describe('ProxyConfig', function () {
expect(config.getForParsedUri({ protocol: 'https:' }).agent).to.be(config.sslAgent);
});
});
context('key is set', function () {
describe('key is set', function () {
it('creates and outputs the agent', function () {
const config = new ProxyConfig({
ssl: {
Expand All @@ -215,7 +215,7 @@ describe('ProxyConfig', function () {
expect(config.getForParsedUri({ protocol: 'https:' }).agent).to.be(config.sslAgent);
});
});
context('cert + key are set', function () {
describe('cert + key are set', function () {
it('creates and outputs the agent', function () {
const config = new ProxyConfig({
ssl: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,67 +67,67 @@ describe('ProxyConfigCollection', function () {
return collection.configForUri(uri).timeout;
}

context('http://localhost:5601', function () {
describe('http://localhost:5601', function () {
it('defaults to the first matching timeout', function () {
expect(getTimeout('http://localhost:5601')).to.be(3);
});
});

context('https://localhost:5601/.kibana', function () {
describe('https://localhost:5601/.kibana', function () {
it('defaults to the first matching timeout', function () {
expect(getTimeout('https://localhost:5601/.kibana')).to.be(1);
});
});

context('http://localhost:5602', function () {
describe('http://localhost:5602', function () {
it('defaults to the first matching timeout', function () {
expect(getTimeout('http://localhost:5602')).to.be(4);
});
});

context('https://localhost:5602', function () {
describe('https://localhost:5602', function () {
it('defaults to the first matching timeout', function () {
expect(getTimeout('https://localhost:5602')).to.be(4);
});
});

context('http://localhost:5603', function () {
describe('http://localhost:5603', function () {
it('defaults to the first matching timeout', function () {
expect(getTimeout('http://localhost:5603')).to.be(4);
});
});

context('https://localhost:5603', function () {
describe('https://localhost:5603', function () {
it('defaults to the first matching timeout', function () {
expect(getTimeout('https://localhost:5603')).to.be(4);
});
});

context('https://localhost:5601/index', function () {
describe('https://localhost:5601/index', function () {
it('defaults to the first matching timeout', function () {
expect(getTimeout('https://localhost:5601/index')).to.be(2);
});
});

context('http://localhost:5601/index', function () {
describe('http://localhost:5601/index', function () {
it('defaults to the first matching timeout', function () {
expect(getTimeout('http://localhost:5601/index')).to.be(3);
});
});

context('https://localhost:5601/index/type', function () {
describe('https://localhost:5601/index/type', function () {
it('defaults to the first matching timeout', function () {
expect(getTimeout('https://localhost:5601/index/type')).to.be(2);
});
});

context('http://notlocalhost', function () {
describe('http://notlocalhost', function () {
it('defaults to the first matching timeout', function () {
expect(getTimeout('http://notlocalhost')).to.be(5);
});
});

context('collection with ssl config and root level verify:false', function () {
describe('collection with ssl config and root level verify:false', function () {
function makeCollection() {
return new ProxyConfigCollection([
{
Expand Down
12 changes: 6 additions & 6 deletions src/core_plugins/console/server/__tests__/proxy_route/body.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,36 +41,36 @@ describe('Console Proxy Route', () => {
});

describe('response body', () => {
context('GET request', () => {
describe('GET request', () => {
it('returns the exact body', async () => {
const { payload } = await request('GET', '/', 'foobar');
expect(payload).to.be('foobar');
});
});
context('POST request', () => {
describe('POST request', () => {
it('returns the exact body', async () => {
const { payload } = await request('POST', '/', 'foobar');
expect(payload).to.be('foobar');
});
});
context('PUT request', () => {
describe('PUT request', () => {
it('returns the exact body', async () => {
const { payload } = await request('PUT', '/', 'foobar');
expect(payload).to.be('foobar');
});
});
context('DELETE request', () => {
describe('DELETE request', () => {
it('returns the exact body', async () => {
const { payload } = await request('DELETE', '/', 'foobar');
expect(payload).to.be('foobar');
});
});
context('HEAD request', () => {
describe('HEAD request', () => {
it('returns the status code and text', async () => {
const { payload } = await request('HEAD', '/');
expect(payload).to.be('200 - OK');
});
context('mixed casing', () => {
describe('mixed casing', () => {
it('returns the status code and text', async () => {
const { payload } = await request('HeAd', '/');
expect(payload).to.be('200 - OK');
Expand Down
12 changes: 6 additions & 6 deletions src/core_plugins/console/server/__tests__/proxy_route/params.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('Console Proxy Route', () => {

describe('params', () => {
describe('pathFilters', () => {
context('no matches', () => {
describe('no matches', () => {
it('rejects with 403', async () => {
const { server } = setup();
server.route(createProxyRoute({
Expand All @@ -51,7 +51,7 @@ describe('Console Proxy Route', () => {
expect(statusCode).to.be(403);
});
});
context('one match', () => {
describe('one match', () => {
it('allows the request', async () => {
const { server } = setup();
server.route(createProxyRoute({
Expand All @@ -70,7 +70,7 @@ describe('Console Proxy Route', () => {
sinon.assert.calledOnce(Wreck.request);
});
});
context('all match', () => {
describe('all match', () => {
it('allows the request', async () => {
const { server } = setup();
server.route(createProxyRoute({
Expand Down Expand Up @@ -147,14 +147,14 @@ describe('Console Proxy Route', () => {
});

describe('baseUrl', () => {
context('default', () => {
describe('default', () => {
it('ensures that the path starts with a /');
});
context('url ends with a slash', () => {
describe('url ends with a slash', () => {
it('combines clean with paths that start with a slash');
it(`combines clean with paths that don't start with a slash`);
});
context(`url doesn't end with a slash`, () => {
describe(`url doesn't end with a slash`, () => {
it('combines clean with paths that start with a slash');
it(`combines clean with paths that don't start with a slash`);
});
Expand Down
Loading

0 comments on commit ee2219d

Please sign in to comment.