Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tests/unit/boilerplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ window.location = { assign: assignMock }
afterEach(() => {
assignMock.mockClear()
})

// throw on any console errors
global.console.error = (message) => {
throw message
}
23 changes: 23 additions & 0 deletions tests/unit/termsOfUserRenderer.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { shallowMount } from '@vue/test-utils'
import TermsOfUseRenderer from '@/components/Pages/TermsOfUse/TermsOfUseRenderer.vue'
require('./boilerplate.js')

describe('About.vue', () => {
it('renders some error text if the api call fails or there is no api', () => {
const mockRoute = {
params: {

Check failure on line 8 in tests/unit/termsOfUserRenderer.spec.js

View workflow job for this annotation

GitHub Actions / build (22)

Expected indentation of 6 spaces but found 8
activeFrom: '0001-01-01'

Check failure on line 9 in tests/unit/termsOfUserRenderer.spec.js

View workflow job for this annotation

GitHub Actions / build (22)

Missing trailing comma

Check failure on line 9 in tests/unit/termsOfUserRenderer.spec.js

View workflow job for this annotation

GitHub Actions / build (22)

Expected indentation of 8 spaces but found 12
}

Check failure on line 10 in tests/unit/termsOfUserRenderer.spec.js

View workflow job for this annotation

GitHub Actions / build (22)

Missing trailing comma

Check failure on line 10 in tests/unit/termsOfUserRenderer.spec.js

View workflow job for this annotation

GitHub Actions / build (22)

Expected indentation of 6 spaces but found 8
}
const mockApi = jest.fn()
const msg = 'An error occurred'
const wrapper = shallowMount(TermsOfUseRenderer, {
mocks: {

Check failure on line 15 in tests/unit/termsOfUserRenderer.spec.js

View workflow job for this annotation

GitHub Actions / build (22)

Expected indentation of 6 spaces but found 12
$route: mockRoute,

Check failure on line 16 in tests/unit/termsOfUserRenderer.spec.js

View workflow job for this annotation

GitHub Actions / build (22)

Expected indentation of 8 spaces but found 16
$api: mockApi

Check failure on line 17 in tests/unit/termsOfUserRenderer.spec.js

View workflow job for this annotation

GitHub Actions / build (22)

Missing trailing comma

Check failure on line 17 in tests/unit/termsOfUserRenderer.spec.js

View workflow job for this annotation

GitHub Actions / build (22)

Expected indentation of 8 spaces but found 16
}

Check failure on line 18 in tests/unit/termsOfUserRenderer.spec.js

View workflow job for this annotation

GitHub Actions / build (22)

Expected indentation of 6 spaces but found 12
}
)
expect(wrapper.text()).toMatch(msg)
})
})
Loading