Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

18272 Add unit test for AboutTheBusiness component #570

Merged
merged 4 commits into from
Nov 8, 2023
Merged
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
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "business-filings-ui",
"version": "7.0.3",
"version": "7.0.4",
"private": true,
"appName": "Filings UI",
"sbcName": "SBC Common Components",
Expand Down
2 changes: 2 additions & 0 deletions src/components/AgmExtension/AboutTheBusiness.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<strong>Business in Good Standing</strong>
</v-col>
<v-col
id="entity-in-good-standing"
cols="12"
sm="9"
>
Expand All @@ -40,6 +41,7 @@
<strong>Date of Incorporation</strong>
</v-col>
<v-col
id="entity-date-of-incorporation"
cols="12"
sm="9"
>
Expand Down
30 changes: 23 additions & 7 deletions tests/unit/AboutTheBusiness.spec.ts
severinbeauvais marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,49 @@ import Vue from 'vue'
import Vuetify from 'vuetify'
import { mount } from '@vue/test-utils'
import AboutTheBusiness from '@/components/AgmExtension/AboutTheBusiness.vue'
import { AgmExtEvalIF, EmptyAgmExtEval } from '@/interfaces'
import { DateUtilities } from '@/services'

Vue.use(Vuetify)
const vuetify = new Vuetify({})

describe('AboutTheBusiness', () => {
it('displays normally', () => {
describe('About The Business component', () => {
it('handles empty data', () => {
const wrapper = mount(AboutTheBusiness, {
propsData: { data: EmptyAgmExtEval },
vuetify
})

expect(wrapper.find('#entity-in-good-standing').text()).toBe('No')
expect(wrapper.find('#entity-date-of-incorporation').text()).toBe('')

wrapper.destroy()
})

it('displays business info properly', () => {
const wrapper = mount(AboutTheBusiness, {
propsData: {
data: {
...EmptyAgmExtEval,
isGoodStanding: true,
incorporationDate: new Date('2023-12-31T08:00:00.000Z')
}
} as AgmExtEvalIF
},
vuetify
})

// verify component displays properly
expect(wrapper.find('.v-card').attributes('id')).toBe('about-the-business')
expect(wrapper.find('header i').attributes('class')).toContain('mdi-domain')
expect(wrapper.find('header h2').text()).toBe('About the Business')

const rows = wrapper.findAll('.content > .row')

expect(rows.at(0).find('.col-sm-3').text()).toBe('Business in Good Standing')
expect(rows.at(0).find('.col-sm-9').text()).toBe('Yes')

expect(rows.at(1).find('.col-sm-3').text()).toBe('Date of Incorporation')
expect(rows.at(1).find('.col-sm-9').text()).toBe('December 31, 2023')

// verify displayed text
expect(wrapper.find('#entity-in-good-standing').text()).toBe('Yes')
expect(wrapper.find('#entity-date-of-incorporation').text()).toBe('December 31, 2023')

wrapper.destroy()
})
Expand Down
Loading