Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,11 @@ describe('<ThresholdWatchEdit /> create route', () => {
triggerIntervalUnit: 'm',
aggType: 'count',
termSize: 5,
termOrder: 'desc',
thresholdComparator: '>',
timeWindowSize: 5,
timeWindowUnit: 'm',
hasTermsAgg: false,
threshold: 1000,
};

Expand Down Expand Up @@ -324,9 +326,11 @@ describe('<ThresholdWatchEdit /> create route', () => {
triggerIntervalUnit: 'm',
aggType: 'count',
termSize: 5,
termOrder: 'desc',
thresholdComparator: '>',
timeWindowSize: 5,
timeWindowUnit: 'm',
hasTermsAgg: false,
threshold: 1000,
};

Expand Down Expand Up @@ -387,9 +391,11 @@ describe('<ThresholdWatchEdit /> create route', () => {
triggerIntervalUnit: 'm',
aggType: 'count',
termSize: 5,
termOrder: 'desc',
thresholdComparator: '>',
timeWindowSize: 5,
timeWindowUnit: 'm',
hasTermsAgg: false,
threshold: 1000,
};

Expand Down Expand Up @@ -461,9 +467,11 @@ describe('<ThresholdWatchEdit /> create route', () => {
triggerIntervalUnit: 'm',
aggType: 'count',
termSize: 5,
termOrder: 'desc',
thresholdComparator: '>',
timeWindowSize: 5,
timeWindowUnit: 'm',
hasTermsAgg: false,
threshold: 1000,
};

Expand Down Expand Up @@ -554,9 +562,11 @@ describe('<ThresholdWatchEdit /> create route', () => {
triggerIntervalUnit: 'm',
aggType: 'count',
termSize: 5,
termOrder: 'desc',
thresholdComparator: '>',
timeWindowSize: 5,
timeWindowUnit: 'm',
hasTermsAgg: false,
threshold: 1000,
};

Expand Down Expand Up @@ -642,9 +652,11 @@ describe('<ThresholdWatchEdit /> create route', () => {
triggerIntervalUnit: 'm',
aggType: 'count',
termSize: 5,
termOrder: 'desc',
thresholdComparator: '>',
timeWindowSize: 5,
timeWindowUnit: 'm',
hasTermsAgg: false,
threshold: 1000,
};

Expand Down Expand Up @@ -710,9 +722,11 @@ describe('<ThresholdWatchEdit /> create route', () => {
triggerIntervalUnit: 'm',
aggType: 'count',
termSize: 5,
termOrder: 'desc',
thresholdComparator: '>',
timeWindowSize: 5,
timeWindowUnit: 'm',
hasTermsAgg: false,
threshold: 1000,
};

Expand Down Expand Up @@ -762,9 +776,11 @@ describe('<ThresholdWatchEdit /> create route', () => {
triggerIntervalUnit: 'm',
aggType: 'count',
termSize: 5,
termOrder: 'desc',
thresholdComparator: '>',
timeWindowSize: 5,
timeWindowUnit: 'm',
hasTermsAgg: false,
threshold: 1000,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ describe('<WatchEdit />', () => {
});

const latestRequest = server.requests[server.requests.length - 1];

const {
id,
type,
Expand All @@ -194,9 +195,11 @@ describe('<WatchEdit />', () => {
triggerIntervalUnit,
aggType,
termSize,
termOrder: 'desc',
thresholdComparator,
timeWindowSize,
timeWindowUnit,
hasTermsAgg: false,
threshold: threshold && threshold[0],
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,11 @@ export class ThresholdWatch extends BaseWatch {
aggField: this.aggField,
termSize: this.termSize,
termField: this.termField,
termOrder: this.termOrder,
thresholdComparator: this.thresholdComparator,
timeWindowSize: this.timeWindowSize,
timeWindowUnit: this.timeWindowUnit,
hasTermsAgg: this.hasTermsAgg,
threshold:
comparators[this.thresholdComparator].requiredValues > 1
? this.threshold
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,6 @@ export class BaseWatch {
return json;
}

// to Elasticsearch
get upstreamJson() {
const watch = this.watchJson;

return {
id: this.id,
watch,
};
}

// from Kibana
static getPropsFromDownstreamJson(json) {
const actions = map(json.actions, action => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,50 +188,6 @@ describe('BaseWatch', () => {
});
});

describe('upstreamJson getter method', () => {
let props;
beforeEach(() => {
props = {
id: 'foo',
name: 'bar',
type: 'json',
watchStatus: {
downstreamJson: {
prop1: 'prop1',
prop2: 'prop2',
},
},
actions: [
{
downstreamJson: {
prop1: 'prop3',
prop2: 'prop4',
},
},
],
};
});

it('should return a valid object', () => {
const watch = new BaseWatch(props);

const actual = watch.upstreamJson;
const expected = {
id: props.id,
watch: {
metadata: {
name: props.name,
xpack: {
type: props.type,
},
},
},
};

expect(actual).toEqual(expected);
});
});

describe('getPropsFromDownstreamJson method', () => {
let downstreamJson;
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ export class JsonWatch extends BaseWatch {
return serializeJsonWatch(this.name, this.watch);
}

// To Elasticsearch
get upstreamJson() {
const result = super.upstreamJson;
return result;
}

// To Kibana
get downstreamJson() {
const result = merge({}, super.downstreamJson, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,6 @@ describe('JsonWatch', () => {
});
});

describe('upstreamJson getter method', () => {
it('should return the correct result', () => {
const watch = new JsonWatch({ watch: { foo: 'bar' } });
const actual = watch.upstreamJson;
const expected = {
id: undefined,
watch: {
foo: 'bar',
metadata: {
xpack: {
type: 'json',
},
},
},
};

expect(actual).toEqual(expected);
});
});

describe('downstreamJson getter method', () => {
let props;
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ export class ThresholdWatch extends BaseWatch {
return formatVisualizeData(this, results);
}

// To Elasticsearch
get upstreamJson() {
const result = super.upstreamJson;
return result;
}

// To Kibana
get downstreamJson() {
const result = merge({}, super.downstreamJson, {
Expand Down