Skip to content

Commit 49a24e5

Browse files
committed
sum all the repeated expected result in for each
1 parent bf8d948 commit 49a24e5

File tree

1 file changed

+40
-46
lines changed

1 file changed

+40
-46
lines changed

src/Components/forms/inputs/EmployerDropDown.test.js

Lines changed: 40 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ describe('EmployerDropDown', () => {
1414
{ name: 'American Express', _id: 'American Express ' },
1515
{ name: 'Capgemini', _id: 'Capgemini' }
1616
]}
17-
employerOnChange={() => {}}
17+
onChange={() => {}}
1818
isEmpty={false}
1919
/>
2020
)
2121
expect(screen.getByTestId('form-group')).toHaveTextContent(
22-
'Who is your employer?'
22+
'Who is your employer? *'
2323
)
2424
expect(screen.getByTestId('form-group')).toHaveTextContent(
2525
'Type your employer name here'
@@ -34,7 +34,7 @@ describe('EmployerDropDown', () => {
3434
{ name: 'Capgemini', _id: 'Capgemini' },
3535
{ name: 'Carnall Farrar', _id: 'Carnall Farrar' }
3636
]}
37-
employerOnChange={() => {}}
37+
onChange={() => {}}
3838
isEmpty={false}
3939
/>
4040
)
@@ -56,15 +56,16 @@ describe('EmployerDropDown', () => {
5656
{ name: 'Beamery', _id: 'Beamery' },
5757
{ name: 'American Express ', _id: 'American Express ' },
5858
{ name: 'Capgemini', _id: 'Capgemini' },
59-
{ name: 'Capnga', _id: 'Capnga' }
59+
{ name: 'Capital', _id: 'Capital' }
6060
]}
61-
employerOnChange={() => {}}
61+
onChange={() => {}}
6262
isEmpty={false}
63-
/>
63+
/>,
64+
{ hidden: true }
6465
)
6566
await user.type(screen.getByRole('combobox', { id: 'employer' }), 'cap')
6667
expect(screen.getByTestId('form-group')).toHaveTextContent('Capgemini')
67-
expect(screen.getByTestId('form-group')).toHaveTextContent('Capnga')
68+
expect(screen.getByTestId('form-group')).toHaveTextContent('Capital')
6869
expect(screen.getByTestId('form-group')).not.toHaveTextContent('Beamery')
6970
})
7071
it('finds characters within words', async () => {
@@ -102,47 +103,40 @@ describe('EmployerDropDown', () => {
102103
]}
103104
employerOnChange={() => {}}
104105
isEmpty={false}
105-
/>
106-
)
107-
await user.type(screen.getByRole('combobox', { id: 'employer' }), 'am')
108-
expect(screen.getByTestId('form-group')).toHaveTextContent('Amazon')
109-
expect(screen.getByTestId('form-group')).toHaveTextContent(
110-
'Amazon Web Services (AWS)'
111-
)
112-
expect(screen.getByTestId('form-group')).toHaveTextContent(
113-
'American Express'
114-
)
115-
expect(screen.getByTestId('form-group')).toHaveTextContent('Beamery')
116-
expect(screen.getByTestId('form-group')).toHaveTextContent(
117-
'Blueprint Gaming'
118-
)
119-
expect(screen.getByTestId('form-group')).toHaveTextContent('EPAM System')
120-
expect(screen.getByTestId('form-group')).toHaveTextContent(
121-
'Inspired Gaming Group'
122-
)
123-
expect(screen.getByTestId('form-group')).toHaveTextContent('Tamarix Tech')
124-
expect(screen.getByTestId('form-group')).not.toHaveTextContent(
125-
'Alpha FX Group'
126-
)
127-
expect(screen.getByTestId('form-group')).not.toHaveTextContent('Anaplan')
128-
expect(screen.getByTestId('form-group')).not.toHaveTextContent('BBC')
129-
expect(screen.getByTestId('form-group')).not.toHaveTextContent('Bet365')
130-
expect(screen.getByTestId('form-group')).not.toHaveTextContent(
131-
'Blue Frontier'
132-
)
133-
expect(screen.getByTestId('form-group')).not.toHaveTextContent('Brandwatch')
134-
expect(screen.getByTestId('form-group')).not.toHaveTextContent(
135-
'EngineerBetter'
136-
)
137-
expect(screen.getByTestId('form-group')).not.toHaveTextContent(
138-
'Equal Experts'
139-
)
140-
expect(screen.getByTestId('form-group')).not.toHaveTextContent('Infobip')
141-
expect(screen.getByTestId('form-group')).not.toHaveTextContent(
106+
/>,
107+
{ hidden: true }
108+
)
109+
const appearingEmployers = [
110+
'Amazon',
111+
'Amazon Web Services (AWS)',
112+
'American Express',
113+
'Beamery',
114+
'Blueprint Gaming',
115+
'EPAM System',
116+
'Inspired Gaming Group',
117+
'Tamarix Tech'
118+
]
119+
const notAppearingApplicants = [
120+
'Alpha FX Group',
121+
'Anaplan',
122+
'BBC',
123+
'Bet365',
124+
'Brandwatch',
125+
'Blue Frontier',
126+
'EngineerBetter',
127+
'Equal Experts',
128+
'Infobip',
129+
'Tata Consultancy services',
142130
'Synaptik Digital'
131+
]
132+
133+
await user.type(screen.getByRole('combobox', { id: 'employer' }), 'am')
134+
135+
appearingEmployers.forEach(employer =>
136+
expect(screen.getByTestId('form-group')).toHaveTextContent(employer)
143137
)
144-
expect(screen.getByTestId('form-group')).not.toHaveTextContent(
145-
'Tata Consultancy services'
138+
notAppearingApplicants.forEach(employer =>
139+
expect(screen.getByTestId('form-group')).not.toHaveTextContent(employer)
146140
)
147141
})
148142
})

0 commit comments

Comments
 (0)