Skip to content

Commit

Permalink
continue adding basic test's
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhonas committed Apr 22, 2023
1 parent 6403e89 commit 0dbba92
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
22 changes: 22 additions & 0 deletions site/src/components/__tests__/ExerciseInstructions.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { describe, it, expect } from 'vitest'

import { mount } from '@vue/test-utils'
import ExerciseInstructions from '../ExerciseInstructions.vue'

describe('ExerciseInstructions', () => {
// when passed an array of text it will render it inside a paragraph
it('renders a single paragraph in non expanded form', () => {
const instructions = [
'This is the first instruction',
'This is the second instruction',
'This is the third instruction'
]
const wrapper = mount(ExerciseInstructions, {
props: { text: instructions }
})

let paragraphs = wrapper.findAll('p')
expect(paragraphs.length).toBe(1)
expect(paragraphs.at(0).text()).toBe(instructions[0])
})
})
12 changes: 0 additions & 12 deletions site/src/components/__tests__/HelloWorld.spec.js

This file was deleted.

12 changes: 12 additions & 0 deletions site/src/components/__tests__/PhotoGallery.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { describe, it, expect } from 'vitest'

import { mount } from '@vue/test-utils'
import PhotoGallery from '../PhotoGallery.vue'

describe('PhotoGallery', () => {
it.skip('when passed an array of photos it should render properly', () => {
const wrapper = mount(PhotoGallery, { props: { photos: ['example.jpg'] } })
// it should render an image with example.jpg as the src
expect(wrapper.find('img').attributes('src')).toBe('example.jpg')
})
})

0 comments on commit 0dbba92

Please sign in to comment.