-
Notifications
You must be signed in to change notification settings - Fork 86
/
ConfigYamlGitterOpt.spec.js
47 lines (44 loc) · 1.26 KB
/
ConfigYamlGitterOpt.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { expect } from 'chai';
import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataGitterOpt.js';
describe('GitterOpt YAML parsing', () => {
it('renders the correct yaml', async () => {
mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });
await store.dispatch('config/load', { type: 'rules', path: 'test123' });
let yaml = store.getters['config/yaml']();
let expected = `__praeco_full_path: "test123"
__praeco_query_builder: "{\\"query\\":{\\"logicalOperator\\":\\"all\\",\\"children\\":[]}}"
alert:
- "gitter"
alert_subject: "this is a test subject"
alert_text: "this is a test body"
alert_text_type: "alert_text_only"
doc_type: "syslog"
filter:
- query:
query_string:
query: "@timestamp:*"
gitter_msg_level: "info"
gitter_proxy: "hostname:8080"
gitter_webhook_url: "https://xxxxxxxxxxxxxx/webhook/xxxxxxxx"
import: "BaseRule.config"
index: "hannibal-*"
is_enabled: false
match_enhancements: []
name: "test123"
num_events: 10000
realert:
minutes: 5
terms_size: 50
timeframe:
minutes: 5
timestamp_field: "@timestamp"
timestamp_type: "iso"
type: "frequency"
use_count_query: true
use_strftime_index: false
`;
return expect(yaml).to.equal(expected);
});
});