mirror of https://github.com/doccano/doccano.git
pythondatasetnatural-language-processingdata-labelingmachine-learningannotation-tooldatasetsactive-learningtext-annotation
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.6 KiB
59 lines
1.6 KiB
import { shallowMount } from '@vue/test-utils'
|
|
import Vue from 'vue'
|
|
import Vuetify from 'vuetify'
|
|
import ProjectDeletionForm from '@/components/organisms/ProjectDeletionForm'
|
|
|
|
Vue.use(Vuetify)
|
|
|
|
describe('ProjectDeletionForm', () => {
|
|
const selected = [
|
|
{
|
|
id: 1,
|
|
name: 'CoNLL 2003',
|
|
description: 'This is a project for NER.',
|
|
guideline: 'Please write annotation guideline.',
|
|
users: [
|
|
1
|
|
],
|
|
project_type: 'SequenceLabeling',
|
|
image: '/static/assets/images/cats/sequence_labeling.jpg',
|
|
updated_at: '2019-07-09T06:19:29.789091Z',
|
|
randomize_document_order: false,
|
|
resourcetype: 'SequenceLabelingProject'
|
|
},
|
|
]
|
|
const factory = (propsData) => {
|
|
return shallowMount(ProjectDeletionForm, {
|
|
propsData: {
|
|
...propsData
|
|
}
|
|
})
|
|
}
|
|
|
|
test('can receive props', () => {
|
|
const wrapper = factory({ selected })
|
|
expect(wrapper.props()).toEqual({ selected })
|
|
})
|
|
|
|
test('emit close event', () => {
|
|
const wrapper = factory({ selected })
|
|
wrapper.vm.cancel(selected)
|
|
expect(wrapper.emitted('close')).toBeTruthy()
|
|
})
|
|
|
|
test('emit delete event', () => {
|
|
const wrapper = factory({ selected })
|
|
wrapper.vm.deleteProject(selected)
|
|
expect(wrapper.emitted('delete')).toBeTruthy()
|
|
})
|
|
|
|
test('raise warning when passing no props', () => {
|
|
const spy = jest.spyOn(console, 'error')
|
|
spy.mockImplementation()
|
|
const wrapper = factory()
|
|
expect(spy).toBeCalledWith(
|
|
expect.stringContaining('[Vue warn]: Missing required prop')
|
|
)
|
|
spy.mockRestore()
|
|
})
|
|
})
|