[test] Move from 'context' to 'describe' (#11013)

This commit is contained in:
Kim Joar Bekkelund 2017-04-04 12:57:42 -04:00 committed by GitHub
parent eb40f7d249
commit ee2219db38
36 changed files with 136 additions and 136 deletions

View file

@ -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');
@ -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');
@ -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();
@ -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();
@ -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();
@ -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 = {};
@ -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');
@ -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');
@ -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();
@ -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();

View file

@ -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, '..');

View file

@ -21,7 +21,7 @@ describe('plugins/console', function () {
};
});
context('proxyConfig', function () {
describe('proxyConfig', function () {
it('leaves the proxyConfig settings', function () {
const proxyConfigOne = {};
const proxyConfigTwo = {};

View file

@ -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');
});

View file

@ -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,
@ -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({
@ -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: {
@ -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: {
@ -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: {
@ -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: {
@ -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: {
@ -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: {
@ -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: {
@ -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: {

View file

@ -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([
{

View file

@ -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');

View file

@ -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({
@ -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({
@ -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({
@ -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`);
});

View file

@ -43,7 +43,7 @@ describe('Console Proxy Route', () => {
describe('query string', () => {
describe('path', () => {
context('contains full url', () => {
describe('contains full url', () => {
it('treats the url as a path', async () => {
await request('GET', 'http://evil.com/test');
sinon.assert.calledOnce(Wreck.request);
@ -51,28 +51,28 @@ describe('Console Proxy Route', () => {
expect(args[1]).to.be('http://localhost:9200/http://evil.com/test');
});
});
context('is missing', () => {
describe('is missing', () => {
it('returns a 400 error', async () => {
const { statusCode } = await request('GET', undefined);
expect(statusCode).to.be(400);
sinon.assert.notCalled(Wreck.request);
});
});
context('is empty', () => {
describe('is empty', () => {
it('returns a 400 error', async () => {
const { statusCode } = await request('GET', '');
expect(statusCode).to.be(400);
sinon.assert.notCalled(Wreck.request);
});
});
context('starts with a slash', () => {
describe('starts with a slash', () => {
it('combines well with the base url', async () => {
await request('GET', '/index/type/id');
sinon.assert.calledOnce(Wreck.request);
expect(Wreck.request.getCall(0).args[1]).to.be('http://localhost:9200/index/type/id');
});
});
context(`doesn't start with a slash`, () => {
describe(`doesn't start with a slash`, () => {
it('combines well with the base url', async () => {
await request('GET', 'index/type/id');
sinon.assert.calledOnce(Wreck.request);
@ -81,28 +81,28 @@ describe('Console Proxy Route', () => {
});
});
describe('method', () => {
context('is missing', () => {
describe('is missing', () => {
it('returns a 400 error', async () => {
const { statusCode } = await request(null, '/');
expect(statusCode).to.be(400);
sinon.assert.notCalled(Wreck.request);
});
});
context('is empty', () => {
describe('is empty', () => {
it('returns a 400 error', async () => {
const { statusCode } = await request('', '/');
expect(statusCode).to.be(400);
sinon.assert.notCalled(Wreck.request);
});
});
context('is an invalid http method', () => {
describe('is an invalid http method', () => {
it('returns a 400 error', async () => {
const { statusCode } = await request('foo', '/');
expect(statusCode).to.be(400);
sinon.assert.notCalled(Wreck.request);
});
});
context('is mixed case', () => {
describe('is mixed case', () => {
it('sends a request with the exact method', async () => {
const { statusCode } = await request('HeAd', '/');
expect(statusCode).to.be(200);

View file

@ -14,7 +14,7 @@ function shouldNot(candidate, ...constructorArgs) {
describe('WildcardMatcher', function () {
context('pattern = *', function () {
describe('pattern = *', function () {
it('matches http', () => should('http', '*'));
it('matches https', () => should('https', '*'));
it('matches nothing', () => should('', '*'));
@ -22,12 +22,12 @@ describe('WildcardMatcher', function () {
it('matches localhost', () => should('localhost', '*'));
it('matches a path', () => should('/index/type/_search', '*'));
context('defaultValue = /', function () {
describe('defaultValue = /', function () {
it('matches /', () => should('/', '*', '/'));
});
});
context('pattern = http', function () {
describe('pattern = http', function () {
it('matches http', () => should('http', 'http'));
it('does not match https', () => shouldNot('https', 'http'));
it('does not match nothing', () => shouldNot('', 'http'));
@ -35,7 +35,7 @@ describe('WildcardMatcher', function () {
it('does not match a path', () => shouldNot('/index/type/_search', 'http'));
});
context('pattern = 560{1..9}', function () {
describe('pattern = 560{1..9}', function () {
it('does not match http', () => shouldNot('http', '560{1..9}'));
it('does not matches 5600', () => shouldNot('5600', '560{1..9}'));
it('matches 5601', () => should('5601', '560{1..9}'));

View file

@ -26,7 +26,7 @@ describe('plugins/elasticsearch', function () {
return compact([basePath, path]).join('.');
};
context(getKey('ssl.verificationMode'), function () {
describe(getKey('ssl.verificationMode'), function () {
let settings;
let sslSettings;

View file

@ -3,7 +3,7 @@ import { parseConfig } from '../parse_config';
describe('plugins/elasticsearch', function () {
describe('lib/parse_config', function () {
context('ssl', function () {
describe('ssl', function () {
let serverConfig;
beforeEach(function () {

View file

@ -5,7 +5,7 @@ import expect from 'expect.js';
describe('Settings', function () {
describe('Advanced', function () {
describe('getEditorType(conf)', function () {
context('when given type has a named editor', function () {
describe('when given type has a named editor', function () {
it('returns that named editor', function () {
expect(getEditorType({ type: 'json' })).to.equal('json');
expect(getEditorType({ type: 'array' })).to.equal('array');
@ -14,7 +14,7 @@ describe('Settings', function () {
});
});
context('when given a type of number, string, null, or undefined', function () {
describe('when given a type of number, string, null, or undefined', function () {
it('returns "normal"', function () {
expect(getEditorType({ type: 'number' })).to.equal('normal');
expect(getEditorType({ type: 'string' })).to.equal('normal');

View file

@ -19,7 +19,7 @@ describe('Settings', function () {
expect(invoke({ value: [] }).type).to.be('array');
});
context('when given a setting definition object', function () {
describe('when given a setting definition object', function () {
let def;
beforeEach(function () {
def = {
@ -45,14 +45,14 @@ describe('Settings', function () {
expect(invoke({ def }).options).to.equal(def.options);
});
context('that contains a type', function () {
describe('that contains a type', function () {
it('sets that type', function () {
def.type = 'something';
expect(invoke({ def }).type).to.equal(def.type);
});
});
context('that contains a value of type array', function () {
describe('that contains a value of type array', function () {
it('sets type to array', function () {
def.value = [];
expect(invoke({ def }).type).to.equal('array');
@ -60,7 +60,7 @@ describe('Settings', function () {
});
});
context('when not given a setting definition object', function () {
describe('when not given a setting definition object', function () {
it('is marked as custom', function () {
expect(invoke().isCustom).to.be.true;
});

View file

@ -46,7 +46,7 @@ describe('xsrf request filter', function () {
afterEach(async () => await kbnServer.close());
for (const method of nonDestructiveMethods) {
context(`nonDestructiveMethod: ${method}`, function () { // eslint-disable-line no-loop-func
describe(`nonDestructiveMethod: ${method}`, function () { // eslint-disable-line no-loop-func
it('accepts requests without a token', async function () {
const resp = await inject(kbnServer, {
url: '/xsrf/test/route',
@ -75,7 +75,7 @@ describe('xsrf request filter', function () {
}
for (const method of destructiveMethods) {
context(`destructiveMethod: ${method}`, function () { // eslint-disable-line no-loop-func
describe(`destructiveMethod: ${method}`, function () { // eslint-disable-line no-loop-func
it('accepts requests with the xsrf header', async function () {
const resp = await inject(kbnServer, {
url: '/xsrf/test/route',

View file

@ -27,7 +27,7 @@ describe('UiExports', function () {
});
//
describe('#defaultInjectedVars', function () {
context('two plugins, two sync', function () {
describe('two plugins, two sync', function () {
this.slow(10000);
this.timeout(60000);
@ -64,7 +64,7 @@ describe('UiExports', function () {
});
});
context('two plugins, one async', function () {
describe('two plugins, one async', function () {
this.slow(10000);
this.timeout(60000);

View file

@ -13,7 +13,7 @@ describe('Binder class', function () {
$scope = $rootScope.$new();
}));
context('Constructing with a $scope', function () {
describe('Constructing with a $scope', function () {
it('accepts a $scope and listens for $destroy', function () {
sinon.stub($scope, '$on');
new Binder($scope);

View file

@ -17,14 +17,14 @@ describe('chrome xsrf apis', function () {
});
});
context('jQuery support', function () {
describe('jQuery support', function () {
it('adds a global jQuery prefilter', function () {
stub($, 'ajaxPrefilter');
xsrfChromeApi({}, { version });
expect($.ajaxPrefilter.callCount).to.be(1);
});
context('jQuery prefilter', function () {
describe('jQuery prefilter', function () {
let prefilter;
beforeEach(function () {
@ -51,7 +51,7 @@ describe('chrome xsrf apis', function () {
});
});
context('Angular support', function () {
describe('Angular support', function () {
let $http;
let $httpBackend;

View file

@ -43,7 +43,7 @@ describe('appSwitcher directive', function () {
});
}
context('when one link is for the active app', function () {
describe('when one link is for the active app', function () {
const myLink = {
active: true,
title: 'myLink',
@ -73,7 +73,7 @@ describe('appSwitcher directive', function () {
});
});
context('when none of the links are for the active app', function () {
describe('when none of the links are for the active app', function () {
const myLink = {
active: false,
title: 'myLink',
@ -103,7 +103,7 @@ describe('appSwitcher directive', function () {
});
});
context('clicking a link with matching href but missing hash', function () {
describe('clicking a link with matching href but missing hash', function () {
const url = 'http://localhost:555/app/myApp?query=1';
beforeEach(setup(url + '#/lastSubUrl', [
{ url: url }
@ -126,7 +126,7 @@ describe('appSwitcher directive', function () {
});
});
context('clicking a link that matches entire url', function () {
describe('clicking a link that matches entire url', function () {
const url = 'http://localhost:555/app/myApp#/lastSubUrl';
beforeEach(setup(url, [
{ url: url }
@ -149,7 +149,7 @@ describe('appSwitcher directive', function () {
});
});
context('clicking a link with matching href but changed hash', function () {
describe('clicking a link with matching href but changed hash', function () {
const rootUrl = 'http://localhost:555/app/myApp?query=1';
const url = rootUrl + '#/lastSubUrl2';
@ -174,7 +174,7 @@ describe('appSwitcher directive', function () {
});
});
context('clicking a link with matching host', function () {
describe('clicking a link with matching host', function () {
beforeEach(setup('http://localhost:555/someOtherPath', [
{
active: true,
@ -195,7 +195,7 @@ describe('appSwitcher directive', function () {
});
});
context('clicking a link with matching host and path', function () {
describe('clicking a link with matching host and path', function () {
beforeEach(setup('http://localhost:555/app/myApp?someQuery=true', [
{
active: true,

View file

@ -67,7 +67,7 @@ describe('SearchSource', function () {
describe('#index()', function () {
describe('auto-sourceFiltering', function () {
context('new index pattern assigned', function () {
describe('new index pattern assigned', function () {
it('generates a source filter', function () {
const source = new SearchSource();
expect(source.get('index')).to.be(undefined);
@ -86,7 +86,7 @@ describe('SearchSource', function () {
});
});
context('new index pattern assigned over another', function () {
describe('new index pattern assigned over another', function () {
it('replaces source filter with new', function () {
const source = new SearchSource();
source.set('index', indexPattern);
@ -107,7 +107,7 @@ describe('SearchSource', function () {
});
});
context('ip assigned before custom source filter', function () {
describe('ip assigned before custom source filter', function () {
it('custom source filter becomes new source', function () {
const source = new SearchSource();
const football = {};
@ -129,7 +129,7 @@ describe('SearchSource', function () {
});
});
context('ip assigned after custom source filter', function () {
describe('ip assigned after custom source filter', function () {
it('leaves the custom filter in place', function () {
const source = new SearchSource();
const football = {};

View file

@ -36,7 +36,7 @@ describe('ui/courier/fetch/_fetch_these', () => {
requests = [ request ];
}));
context('when request has not started', () => {
describe('when request has not started', () => {
beforeEach(() => requests.forEach(req => req.started = false));
it('starts request', () => {
@ -63,7 +63,7 @@ describe('ui/courier/fetch/_fetch_these', () => {
});
});
context('when request has already started', () => {
describe('when request has already started', () => {
it('continues request', () => {
fetchThese(requests);
expect(request.start.called).to.be(false);

View file

@ -26,7 +26,7 @@ describe('Segmented Request Size Picking', function () {
};
}));
context('without a size', function () {
describe('without a size', function () {
it('does not set the request size', async function () {
const req = new SegmentedReq(new MockSource());
req._handle.setDirection('desc');
@ -37,7 +37,7 @@ describe('Segmented Request Size Picking', function () {
});
});
context('with a size', function () {
describe('with a size', function () {
it('sets the request size to the entire desired size', async function () {
const req = new SegmentedReq(new MockSource());
req._handle.setDirection('desc');

View file

@ -42,7 +42,7 @@ describe('ui/courier/fetch/strategy/search', () => {
});
});
context('when indexList is not empty', () => {
describe('when indexList is not empty', () => {
it('includes the index', () => {
return search.reqsFetchParamsToBody(reqsFetchParams).then(value => {
expect(_.includes(value, '"index":["logstash-123"]')).to.be(true);
@ -50,7 +50,7 @@ describe('ui/courier/fetch/strategy/search', () => {
});
});
context('when indexList is empty', () => {
describe('when indexList is empty', () => {
beforeEach(() => {
reqsFetchParams.forEach(request => request.index = []);
});
@ -72,7 +72,7 @@ describe('ui/courier/fetch/strategy/search', () => {
});
});
context('when passed IndexPatterns', () => {
describe('when passed IndexPatterns', () => {
it(' that are out of range, queries .kibana', () => {
// Check out https://github.com/elastic/kibana/issues/10905 for the reasons behind this
// test. When an IndexPattern is out of time range, it returns an array that is then stored in a cache. This

View file

@ -43,7 +43,7 @@ describe('filterBarClickHandler', function () {
notify._notifs.splice(0);
});
context('on non-filterable fields', function () {
describe('on non-filterable fields', function () {
it('warns about trying to filter on a non-filterable field', function () {
const { clickHandler, aggConfigResult } = setup();
expect(notify._notifs).to.have.length(0);

View file

@ -309,7 +309,7 @@ describe('index pattern', function () {
});
describe('#toDetailedIndexList', function () {
context('when index pattern is an interval', function () {
describe('when index pattern is an interval', function () {
let interval;
beforeEach(function () {
interval = 'result:getInterval';
@ -327,7 +327,7 @@ describe('index pattern', function () {
expect(indexList[1].index).to.equal('bar');
});
context('with sort order', function () {
describe('with sort order', function () {
it('passes the sort order to the intervals module', function () {
return indexPattern.toDetailedIndexList(1, 2, 'SORT_DIRECTION')
.then(function () {
@ -338,7 +338,7 @@ describe('index pattern', function () {
});
});
context('when index pattern is a time-base wildcard', function () {
describe('when index pattern is a time-base wildcard', function () {
beforeEach(function () {
sinon.stub(indexPattern, 'getInterval').returns(false);
sinon.stub(indexPattern, 'hasTimeField').returns(true);
@ -359,7 +359,7 @@ describe('index pattern', function () {
});
});
context('when index pattern is a time-base wildcard that is configured not to expand', function () {
describe('when index pattern is a time-base wildcard that is configured not to expand', function () {
beforeEach(function () {
sinon.stub(indexPattern, 'getInterval').returns(false);
sinon.stub(indexPattern, 'hasTimeField').returns(true);
@ -373,7 +373,7 @@ describe('index pattern', function () {
});
});
context('when index pattern is neither an interval nor a time-based wildcard', function () {
describe('when index pattern is neither an interval nor a time-based wildcard', function () {
beforeEach(function () {
sinon.stub(indexPattern, 'getInterval').returns(false);
});
@ -386,7 +386,7 @@ describe('index pattern', function () {
});
describe('#toIndexList', function () {
context('when index pattern is an interval', function () {
describe('when index pattern is an interval', function () {
let interval;
beforeEach(function () {
@ -405,7 +405,7 @@ describe('index pattern', function () {
expect(indexList[1]).to.equal('bar');
});
context('with sort order', function () {
describe('with sort order', function () {
it('passes the sort order to the intervals module', function () {
return indexPattern.toIndexList(1, 2, 'SORT_DIRECTION')
.then(function () {
@ -416,7 +416,7 @@ describe('index pattern', function () {
});
});
context('when index pattern is a time-base wildcard', function () {
describe('when index pattern is a time-base wildcard', function () {
beforeEach(function () {
sinon.stub(indexPattern, 'getInterval').returns(false);
sinon.stub(indexPattern, 'hasTimeField').returns(true);
@ -437,7 +437,7 @@ describe('index pattern', function () {
});
});
context('when index pattern is a time-base wildcard that is configured not to expand', function () {
describe('when index pattern is a time-base wildcard that is configured not to expand', function () {
beforeEach(function () {
sinon.stub(indexPattern, 'getInterval').returns(false);
sinon.stub(indexPattern, 'hasTimeField').returns(true);
@ -451,7 +451,7 @@ describe('index pattern', function () {
});
});
context('when index pattern is neither an interval nor a time-based wildcard', function () {
describe('when index pattern is neither an interval nor a time-based wildcard', function () {
beforeEach(function () {
sinon.stub(indexPattern, 'getInterval').returns(false);
});

View file

@ -64,7 +64,7 @@ describe('ui/index_patterns/_calculate_indices', () => {
expect(_.size(constraints['@something'])).to.equal(0);
});
context('when given start', () => {
describe('when given start', () => {
beforeEach(() => run({ start: '1234567890' }));
it('includes max_value', () => {
expect(constraints['@something']).to.have.property('max_value');
@ -85,7 +85,7 @@ describe('ui/index_patterns/_calculate_indices', () => {
});
});
context('when given stop', () => {
describe('when given stop', () => {
beforeEach(() => run({ stop: '1234567890' }));
it('includes min_value', () => {
expect(constraints['@something']).to.have.property('min_value');
@ -118,7 +118,7 @@ describe('ui/index_patterns/_calculate_indices', () => {
describe('response sorting', function () {
require('test_utils/no_digest_promises').activateForSuite();
context('when no sorting direction given', function () {
describe('when no sorting direction given', function () {
it('returns the indices in the order that elasticsearch sends them', function () {
response = {
indices: {
@ -134,7 +134,7 @@ describe('ui/index_patterns/_calculate_indices', () => {
});
});
context('when sorting asc', function () {
describe('when sorting asc', function () {
it('resolves to an array of objects, each with index, start, and end properties', function () {
response = {
indices: {
@ -166,7 +166,7 @@ describe('ui/index_patterns/_calculate_indices', () => {
});
});
context('when sorting desc', function () {
describe('when sorting desc', function () {
it('resolves to an array of objects, each with index, min, and max properties', function () {
response = {
indices: {

View file

@ -123,7 +123,7 @@ describe('Index Patterns', function () {
]);
});
context('with sortDirection=asc', function () {
describe('with sortDirection=asc', function () {
it('returns values in ascending order', function () {
const start = moment.utc('2014-12-01');
const end = moment.utc('2015-02-01');
@ -144,7 +144,7 @@ describe('Index Patterns', function () {
});
});
context('with sortDirection=desc', function () {
describe('with sortDirection=desc', function () {
it('returns values in descending order', function () {
const start = moment.utc('2014-12-01');
const end = moment.utc('2015-02-01');

View file

@ -30,7 +30,7 @@ describe('ui/modals/confirm_modal_promise', function () {
}
});
context('before timeout completes', function () {
describe('before timeout completes', function () {
it('returned promise is not resolved', function () {
const callback = sinon.spy();
promise.then(callback, callback);
@ -39,7 +39,7 @@ describe('ui/modals/confirm_modal_promise', function () {
});
});
context('after timeout completes', function () {
describe('after timeout completes', function () {
it('confirmation dialogue is loaded to dom with message', function () {
$rootScope.$digest();
const confirmModalElement = angular.element(document.body).find('[data-test-subj=confirmModal]');
@ -50,7 +50,7 @@ describe('ui/modals/confirm_modal_promise', function () {
expect(htmlString.indexOf(message)).to.be.greaterThan(0);
});
context('when confirmed', function () {
describe('when confirmed', function () {
it('promise is fulfilled with true', function () {
const confirmCallback = sinon.spy();
const cancelCallback = sinon.spy();
@ -66,7 +66,7 @@ describe('ui/modals/confirm_modal_promise', function () {
});
});
context('when canceled', function () {
describe('when canceled', function () {
it('promise is rejected with false', function () {
const confirmCallback = sinon.spy();
const cancelCallback = sinon.spy();
@ -82,7 +82,7 @@ describe('ui/modals/confirm_modal_promise', function () {
});
});
context('error is thrown', function () {
describe('error is thrown', function () {
it('when no confirm button text is used', function () {
try {
confirmModalPromise(message);

View file

@ -420,13 +420,13 @@ describe('Notifier', function () {
}
function testVersionInfo(fnName) {
context('when version is configured', function () {
describe('when version is configured', function () {
it('adds version to notification', function () {
const notification = notify(fnName);
expect(notification.info.version).to.equal(version);
});
});
context('when build number is configured', function () {
describe('when build number is configured', function () {
it('adds buildNum to notification', function () {
const notification = notify(fnName);
expect(notification.info.buildNum).to.equal(buildNum);

View file

@ -116,24 +116,24 @@ describe('Promise service', function () {
it('allows non-promises in the array', async () => {
expect(await Promise.race([1,2,3])).to.be(1);
});
context('argument is undefined', () => {
describe('argument is undefined', () => {
it('rejects the promise', async () => {
const football = {};
expect(await Promise.race().catch(() => football)).to.be(football);
});
});
context('argument is a string', () => {
describe('argument is a string', () => {
it(`resolves with the first character`, async () => {
expect(await Promise.race('abc')).to.be('a');
});
});
context('argument is a non-iterable object', () => {
describe('argument is a non-iterable object', () => {
it('reject the promise', async () => {
const football = {};
expect(await Promise.race({}).catch(() => football)).to.be(football);
});
});
context('argument is a generator', () => {
describe('argument is a generator', () => {
it('resolves with the first resolved value', async () => {
function *gen() {
yield new Promise(resolve => setTimeout(resolve, 100, 1));

View file

@ -231,7 +231,7 @@ describe('State Management', function () {
expect(hashedItemStore.getItem(urlVal)).to.eql(JSON.stringify(obj));
});
context('error handling', () => {
describe('error handling', () => {
it('notifies the user when a hash value does not map to a stored value', () => {
const { state, notifier } = setup({ storeInHash: true });
const search = $location.search();

View file

@ -11,7 +11,7 @@ describe('Color Format', function () {
ColorFormat = fieldFormats.getType('color');
}));
context('field is a number', () => {
describe('field is a number', () => {
it('should add colors if the value is in range', function () {
const colorer = new ColorFormat({
fieldType: 'number',
@ -40,7 +40,7 @@ describe('Color Format', function () {
});
});
context('field is a string', () => {
describe('field is a string', () => {
it('should add colors if the regex matches', function () {
const colorer = new ColorFormat({
fieldType: 'string',

View file

@ -37,7 +37,7 @@ describe('aggressiveParse', () => {
expect(_.has(result, 'another.level.$deep')).to.be(false);
});
context('with arity of 2', () => {
describe('with arity of 2', () => {
beforeEach(() => {
result = aggressiveParse.toJson(object, jsonFn);
result = JSON.parse(result);
@ -56,7 +56,7 @@ describe('aggressiveParse', () => {
});
});
context('with arity of 3', () => {
describe('with arity of 3', () => {
beforeEach(() => {
result = aggressiveParse.toJson({ foo: 'bar' }, undefined, 2);
});

View file

@ -22,8 +22,8 @@ describe('ui/utils/mapping_setup', function () {
expect(mapping.foo.type).to.be('integer');
});
context('when type is json', function () {
it('returned object is type string', function () {
describe('when type is json', function () {
it('returned object is type text', function () {
const mapping = mappingSetup.expandShorthand({ foo: 'json' });
expect(mapping.foo.type).to.be('string');
});

View file

@ -65,7 +65,7 @@ describe('Vislib Color Module Test Suite', function () {
}).to.throwError();
});
context('when array is not composed of numbers, strings, or undefined values', function () {
describe('when array is not composed of numbers, strings, or undefined values', function () {
it('should throw an error', function () {
expect(function () {
getColors(arrayOfObjects);
@ -81,7 +81,7 @@ describe('Vislib Color Module Test Suite', function () {
});
});
context('when input is an array of strings, numbers, or undefined values', function () {
describe('when input is an array of strings, numbers, or undefined values', function () {
it('should not throw an error', function () {
expect(function () {
getColors(arr);

View file

@ -18,7 +18,7 @@ describe('promiseFromStreams', () => {
expect(await sumPromise).to.be(6);
});
context('last stream is writable', () => {
describe('last stream is writable', () => {
it('waits for the last stream to finish writing', async () => {
let written = '';
@ -51,7 +51,7 @@ describe('promiseFromStreams', () => {
});
});
context('last stream is readable', () => {
describe('last stream is readable', () => {
it(`resolves to it's final value`, async () => {
const result = await createPromiseFromStreams([
createListStream(['a', 'b', 'c'])
@ -61,7 +61,7 @@ describe('promiseFromStreams', () => {
});
});
context('last stream is duplex', () => {
describe('last stream is duplex', () => {
it('waits for writing and resolves to final value', async () => {
let written = '';
const result = await createPromiseFromStreams([