Skip to content

Commit

Permalink
Fixed npm run test:coverage error
Browse files Browse the repository at this point in the history
  • Loading branch information
nsano-rururu committed Jan 10, 2024
1 parent 6ab3c13 commit 6431653
Show file tree
Hide file tree
Showing 78 changed files with 115 additions and 245 deletions.
2 changes: 1 addition & 1 deletion tests/unit/mockData/alert/ruleDataDiscordOpt.js
Expand Up @@ -6,7 +6,7 @@ alert_subject_args: []
alert_text: this is a test body
alert_text_args: []
alert_text_type: alert_text_only
discord_emoji_title: ':error:'
discord_emoji_title: ':postal_horn:'
discord_embed_footer: footer
discord_embed_icon_url: http://testserver/xxx/test.png
discord_proxy: https://hostname:8080/
Expand Down
5 changes: 3 additions & 2 deletions tests/unit/specs/ConfigCondition.spec.js
Expand Up @@ -27,9 +27,10 @@ async function prep() {

let wrapper;

describe('ConfigCondition log', () => {
describe('ConfigCondition log', async () => {
wrapper = await prep();

it('renders the numEvents', async () => {
wrapper = await prep();
return expect(wrapper.text()).to.contain('ABOVE 10000');
});

Expand Down
4 changes: 1 addition & 3 deletions tests/unit/specs/ConfigYamlScanEntireTimefame.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../setup';
import { ruleYaml } from '../mockData/ruleDataScanEntireTimefame.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('ScanEntireTimefame YAML parsing', () => {
it('renders the correct yaml', async () => {
mockAxios.onGet('/api/rules/test123').reply(200, ruleYaml);
await store.dispatch('config/load', { type: 'rules', path: 'test123' });

let yaml = store.getters['config/yaml']();

let expected = `__praeco_full_path: "test123"
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/specs/QueriesLog.spec.js
Expand Up @@ -3,10 +3,9 @@ import Queries from '@/views/Queries';
import mockQueryLog from '../mockData/queryLog.json';
import { mountComponent, mockAxios } from '../setup';

mockAxios.onGet('/api/metadata/elastalert_status').reply(200, mockQueryLog);

describe('Queries log', () => {
it('renders the query log correctly', (done) => {
mockAxios.onGet('/api/metadata/elastalert_status').reply(200, mockQueryLog);
let wrapper = mountComponent(Queries);

wrapper.setData({
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/specs/alert/ConfigYamlAlerta.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataAlerta.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('Alerta 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"
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/specs/alert/ConfigYamlAlerta002.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataAlerta002.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('Alerta 002 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"
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/specs/alert/ConfigYamlAlertaOpt.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataAlertaOpt.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('AlertaOpt 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"
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/specs/alert/ConfigYamlAlertmanager.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataAlertmanager.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('Alertmanager 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"
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/specs/alert/ConfigYamlAlertmanager002.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataAlertmanager002.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('Alertmanager YAML parsing', () => {
describe('Alertmanager 002 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"
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/specs/alert/ConfigYamlChatwork.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataChatwork.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('Chatwork 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"
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/specs/alert/ConfigYamlCommand.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataCommand.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('Command 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"
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/specs/alert/ConfigYamlDataDatadog.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataDatadog.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('Datadog 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"
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/specs/alert/ConfigYamlDingtalk.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataDingtalk.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('Alerta YAML parsing', () => {
describe('Dingtalk 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"
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/specs/alert/ConfigYamlDingtalk002.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataDingtalk002.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('Alerta YAML parsing', () => {
describe('Dingtalk 002 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"
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/specs/alert/ConfigYamlDingtalk003.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataDingtalk003.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('Alerta YAML parsing', () => {
describe('Dingtalk 003 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"
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/specs/alert/ConfigYamlDingtalk004.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataDingtalk004.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('Alerta YAML parsing', () => {
describe('Dingtalk 003 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"
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/specs/alert/ConfigYamlDiscord.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataDiscord.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('Discord 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"
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/specs/alert/ConfigYamlDiscordOpt.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataDiscordOpt.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('DiscordOpt 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"
Expand All @@ -20,7 +18,7 @@ alert_text: "this is a test body"
alert_text_type: "alert_text_only"
discord_embed_footer: "footer"
discord_embed_icon_url: "http://testserver/xxx/test.png"
discord_emoji_title: ":error:"
discord_emoji_title: ":postal_horn:"
discord_proxy: "https://hostname:8080/"
discord_proxy_login: "user"
discord_proxy_password: "password"
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/specs/alert/ConfigYamlEmail.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataEmail.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('Alerta YAML parsing', () => {
describe('Email 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"
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/specs/alert/ConfigYamlEmail002.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataEmail002.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('Alerta YAML parsing', () => {
describe('Email 002 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"
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/specs/alert/ConfigYamlExotel.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataExotel.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('Exotel 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"
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/specs/alert/ConfigYamlGelf001.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataGelf001.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('Gelf 001 YAML parsing', () => {
describe('Gelf 001 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"
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/specs/alert/ConfigYamlGelf002.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataGelf002.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('Gelf 002 YAML parsing', () => {
describe('Gelf 002 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"
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/specs/alert/ConfigYamlGitter.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataGitter.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('Gitter 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"
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/specs/alert/ConfigYamlGitterOpt.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataGitterOpt.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

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"
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/specs/alert/ConfigYamlGoogleChat.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataGoogleChat.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('GoogleChat 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"
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/specs/alert/ConfigYamlGoogleChat002.spec.js
Expand Up @@ -3,12 +3,10 @@ import store from '@/store';
import { mockAxios } from '../../setup';
import { ruleYaml } from '../../mockData/alert/ruleDataGoogleChat002.js';

mockAxios.onGet('/api/rules/test123').reply(200, { yaml: ruleYaml });

describe('GoogleChat YAML parsing', () => {
describe('GoogleChat 002 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"
Expand Down

0 comments on commit 6431653

Please sign in to comment.