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
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|