diff --git a/.doc-jitrc b/.doc-jitrc index b5dfc5e..9def849 100644 --- a/.doc-jitrc +++ b/.doc-jitrc @@ -1,6 +1,7 @@ { "patterns": { "**/*.vue": "https://vuejs.org/guide/introduction.html", + "**/*.test.ts": "https://v1.test-utils.vuejs.org/guides", "**/*.store.ts": "https://pinia.vuejs.org/introduction.html", "**/router/*.ts": "https://router.vuejs.org/" } diff --git a/src/components/EstimationTimeArrival.test.ts b/src/components/EstimationTimeArrival.test.ts new file mode 100644 index 0000000..90985ce --- /dev/null +++ b/src/components/EstimationTimeArrival.test.ts @@ -0,0 +1,23 @@ +import { mount } from '@vue/test-utils' +import { describe, expect, it } from 'vitest' +import EstimationTimeArrival from './EstimationTimeArrival.vue' + +describe('Estimation Time Arrival', () => { + it('renders an ETA tag and the estimation', () => { + const wrapper = mount(EstimationTimeArrival, { + props: { + estimation: 4 + } + }) + + expect(wrapper.get('.tags')).toBeDefined() + + const tags = wrapper.findAll('.tag') + + expect(tags.length).toBe(2) + const [eta, label] = tags + + expect(eta.text()).toEqual('ETA') + expect(label.text()).toEqual('4 minutes') + }) +}) diff --git a/src/components/EstimationTimeArrival.vue b/src/components/EstimationTimeArrival.vue new file mode 100644 index 0000000..fd967a6 --- /dev/null +++ b/src/components/EstimationTimeArrival.vue @@ -0,0 +1,17 @@ + + +