debian-mirror-gitlab/spec/frontend/error_tracking/components/stacktrace_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-12-26 22:10:19 +05:30
import { shallowMount } from '@vue/test-utils';
import Stacktrace from '~/error_tracking/components/stacktrace.vue';
import StackTraceEntry from '~/error_tracking/components/stacktrace_entry.vue';
describe('ErrorDetails', () => {
let wrapper;
const stackTraceEntry = {
filename: 'sidekiq/util.rb',
context: [
[22, ' def safe_thread(name, \u0026block)\n'],
[23, ' Thread.new do\n'],
[24, " Thread.current['sidekiq_label'] = name\n"],
[25, ' watchdog(name, \u0026block)\n'],
],
lineNo: 24,
};
function mountComponent(entries) {
wrapper = shallowMount(Stacktrace, {
propsData: {
entries,
},
});
}
describe('Stacktrace', () => {
it('should render single Stacktrace entry', () => {
mountComponent([stackTraceEntry]);
2022-08-27 11:52:29 +05:30
expect(wrapper.findAllComponents(StackTraceEntry).length).toBe(1);
2019-12-26 22:10:19 +05:30
});
it('should render multiple Stacktrace entry', () => {
const entriesNum = 3;
mountComponent(new Array(entriesNum).fill(stackTraceEntry));
2022-08-27 11:52:29 +05:30
expect(wrapper.findAllComponents(StackTraceEntry).length).toBe(entriesNum);
2019-12-26 22:10:19 +05:30
});
});
});