-
-
Save dvallin/ad674e4a22aba65604f001858347c1e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import TodoList from '@/components/TodoList' | |
import TodoListItem from '@/components/TodoListItem' | |
import {Task} from "@/domain/Task"; | |
import {shallow} from 'vue-test-utils' | |
const task = new Task("Some Title"); | |
describe('TodoList.vue', () => { | |
it('renders empty lists', () => { | |
const cmp = shallow(TodoList, { | |
propsData: { | |
tasks: [] | |
} | |
}); | |
expect(cmp.element).toMatchSnapshot(); | |
expect(cmp.vm.$el.childNodes.length).toBe(0); | |
}); | |
it('renders three element lists', () => { | |
const cmp = shallow(TodoList, { | |
propsData: { | |
tasks: [task,task,task] | |
} | |
}); | |
expect(cmp.element).toMatchSnapshot(); | |
expect(cmp.find(TodoListItem).vm.task.title).toEqual('Some Title'); | |
expect(cmp.findAll(TodoListItem).length).toBe(3); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment