Skip to content

Commit 74bfcac

Browse files
committed
added first simple vue test
1 parent 00ad8b0 commit 74bfcac

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { shallowMount, createLocalVue } from '@vue/test-utils';
2+
import test from 'ava';
3+
import VueRouter from 'vue-router';
4+
import Vuetify from 'vuetify';
5+
import i18n from '../../src/trans';
6+
import SnapshotList from '../../src/components/SnapshotList.vue';
7+
8+
const localVue = createLocalVue();
9+
const router = new VueRouter();
10+
localVue.use(VueRouter);
11+
localVue.use(Vuetify);
12+
const vuetify = new Vuetify();
13+
14+
test('SnapshotList.vue', (t) => {
15+
const snapshots = [
16+
{ id: 'ABC111', pk: 'ABC111', title: 'title 1' },
17+
{ id: 'ABC222', pk: 'ABC222', title: 'title 2' }
18+
];
19+
const wrapper = shallowMount(SnapshotList, {
20+
router,
21+
i18n,
22+
vuetify,
23+
propsData: {
24+
workspaceHash: 'test',
25+
snapshots
26+
}
27+
});
28+
t.is(wrapper.findAll('v-list-item-stub').length, snapshots.length);
29+
t.true(wrapper.text().includes('title 2'));
30+
});

0 commit comments

Comments
 (0)