mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
This commit is contained in:
parent
1aeb45a5f2
commit
9ea8a0f9d1
3 changed files with 25 additions and 16 deletions
11
x-pack/plugins/grokdebugger/jest.config.js
Normal file
11
x-pack/plugins/grokdebugger/jest.config.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
preset: '@kbn/test',
|
||||
rootDir: '../../..',
|
||||
roots: ['<rootDir>/x-pack/plugins/grokdebugger'],
|
||||
};
|
|
@ -4,8 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { GrokdebuggerRequest } from '../grokdebugger_request';
|
||||
import { GrokdebuggerRequest } from './grokdebugger_request';
|
||||
|
||||
// FAILING: https://github.com/elastic/kibana/issues/51372
|
||||
describe.skip('grokdebugger_request', () => {
|
||||
|
@ -24,18 +23,18 @@ describe.skip('grokdebugger_request', () => {
|
|||
describe('fromDownstreamJSON factory method', () => {
|
||||
it('returns correct GrokdebuggerRequest instance from downstreamRequest', () => {
|
||||
const grokdebuggerRequest = GrokdebuggerRequest.fromDownstreamJSON(downstreamRequest);
|
||||
expect(grokdebuggerRequest.rawEvent).to.eql(downstreamRequest.rawEvent);
|
||||
expect(grokdebuggerRequest.pattern).to.eql(downstreamRequest.pattern);
|
||||
expect(grokdebuggerRequest.customPatterns).to.eql({});
|
||||
expect(grokdebuggerRequest.rawEvent).toEqual(downstreamRequest.rawEvent);
|
||||
expect(grokdebuggerRequest.pattern).toEqual(downstreamRequest.pattern);
|
||||
expect(grokdebuggerRequest.customPatterns).toEqual({});
|
||||
});
|
||||
|
||||
it('returns correct GrokdebuggerRequest instance from downstreamRequest when custom patterns are specified', () => {
|
||||
const grokdebuggerRequest = GrokdebuggerRequest.fromDownstreamJSON(
|
||||
downstreamRequestWithCustomPatterns
|
||||
);
|
||||
expect(grokdebuggerRequest.rawEvent).to.eql(downstreamRequest.rawEvent);
|
||||
expect(grokdebuggerRequest.pattern).to.eql(downstreamRequest.pattern);
|
||||
expect(grokdebuggerRequest.customPatterns).to.eql('%{FOO:bar}');
|
||||
expect(grokdebuggerRequest.rawEvent).toEqual(downstreamRequest.rawEvent);
|
||||
expect(grokdebuggerRequest.pattern).toEqual(downstreamRequest.pattern);
|
||||
expect(grokdebuggerRequest.customPatterns).toEqual('%{FOO:bar}');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -67,7 +66,7 @@ describe.skip('grokdebugger_request', () => {
|
|||
};
|
||||
const grokdebuggerRequest = GrokdebuggerRequest.fromDownstreamJSON(downstreamRequest);
|
||||
const upstreamJson = grokdebuggerRequest.upstreamJSON;
|
||||
expect(upstreamJson).to.eql(expectedUpstreamJSON);
|
||||
expect(upstreamJson).toEqual(expectedUpstreamJSON);
|
||||
});
|
||||
|
||||
it('returns the upstream simulate JSON request when custom patterns are specified', () => {
|
||||
|
@ -99,7 +98,7 @@ describe.skip('grokdebugger_request', () => {
|
|||
downstreamRequestWithCustomPatterns
|
||||
);
|
||||
const upstreamJson = grokdebuggerRequest.upstreamJSON;
|
||||
expect(upstreamJson).to.eql(expectedUpstreamJSON);
|
||||
expect(upstreamJson).toEqual(expectedUpstreamJSON);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -4,8 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { GrokdebuggerResponse } from '../grokdebugger_response';
|
||||
import { GrokdebuggerResponse } from './grokdebugger_response';
|
||||
|
||||
describe('grokdebugger_response', () => {
|
||||
describe('GrokdebuggerResponse', () => {
|
||||
|
@ -38,8 +37,8 @@ describe('grokdebugger_response', () => {
|
|||
client: '55.3.244.1',
|
||||
};
|
||||
const grokdebuggerResponse = GrokdebuggerResponse.fromUpstreamJSON(upstreamJson);
|
||||
expect(grokdebuggerResponse.structuredEvent).to.eql(expectedStructuredEvent);
|
||||
expect(grokdebuggerResponse.error).to.eql({});
|
||||
expect(grokdebuggerResponse.structuredEvent).toEqual(expectedStructuredEvent);
|
||||
expect(grokdebuggerResponse.error).toEqual({});
|
||||
});
|
||||
|
||||
it('returns correct GrokdebuggerResponse instance when there are valid grok parse errors', () => {
|
||||
|
@ -62,8 +61,8 @@ describe('grokdebugger_response', () => {
|
|||
],
|
||||
};
|
||||
const grokdebuggerResponse = GrokdebuggerResponse.fromUpstreamJSON(upstreamJson);
|
||||
expect(grokdebuggerResponse.structuredEvent).to.eql({});
|
||||
expect(grokdebuggerResponse.error).to.be(
|
||||
expect(grokdebuggerResponse.structuredEvent).toEqual({});
|
||||
expect(grokdebuggerResponse.error).toBe(
|
||||
'Provided Grok patterns do not match data in the input'
|
||||
);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue