Skip to content

Commit fa144c9

Browse files
committed
chore: Migrate jest expectation function
* Replace toBeCalledWith with toHaveBeenCalledWith
1 parent 33c7a0b commit fa144c9

File tree

2 files changed

+104
-104
lines changed

2 files changed

+104
-104
lines changed

src/dependabot/output.test.ts

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,18 @@ test('when given a single dependency it sets its values', async () => {
5454

5555
expect(core.setOutput).toHaveBeenCalledWith('updated-dependencies-json', updatedDependencies)
5656

57-
expect(core.setOutput).toBeCalledWith('dependency-names', 'coffee-rails')
58-
expect(core.setOutput).toBeCalledWith('dependency-type', 'direct:production')
59-
expect(core.setOutput).toBeCalledWith('update-type', 'version-update:semver-minor')
60-
expect(core.setOutput).toBeCalledWith('directory', 'wwwroot')
61-
expect(core.setOutput).toBeCalledWith('package-ecosystem', 'nuget')
62-
expect(core.setOutput).toBeCalledWith('target-branch', 'main')
63-
expect(core.setOutput).toBeCalledWith('previous-version', '1.0.2')
64-
expect(core.setOutput).toBeCalledWith('new-version', '1.1.3-beta')
65-
expect(core.setOutput).toBeCalledWith('compatibility-score', 43)
66-
expect(core.setOutput).toBeCalledWith('alert-state', 'FIXED')
67-
expect(core.setOutput).toBeCalledWith('ghsa-id', 'VERY_LONG_ID')
68-
expect(core.setOutput).toBeCalledWith('cvss', 4.6)
57+
expect(core.setOutput).toHaveBeenCalledWith('dependency-names', 'coffee-rails')
58+
expect(core.setOutput).toHaveBeenCalledWith('dependency-type', 'direct:production')
59+
expect(core.setOutput).toHaveBeenCalledWith('update-type', 'version-update:semver-minor')
60+
expect(core.setOutput).toHaveBeenCalledWith('directory', 'wwwroot')
61+
expect(core.setOutput).toHaveBeenCalledWith('package-ecosystem', 'nuget')
62+
expect(core.setOutput).toHaveBeenCalledWith('target-branch', 'main')
63+
expect(core.setOutput).toHaveBeenCalledWith('previous-version', '1.0.2')
64+
expect(core.setOutput).toHaveBeenCalledWith('new-version', '1.1.3-beta')
65+
expect(core.setOutput).toHaveBeenCalledWith('compatibility-score', 43)
66+
expect(core.setOutput).toHaveBeenCalledWith('alert-state', 'FIXED')
67+
expect(core.setOutput).toHaveBeenCalledWith('ghsa-id', 'VERY_LONG_ID')
68+
expect(core.setOutput).toHaveBeenCalledWith('cvss', 4.6)
6969
})
7070

7171
test('when given a multiple dependencies, it uses the highest values for types', async () => {
@@ -100,18 +100,18 @@ test('when given a multiple dependencies, it uses the highest values for types',
100100

101101
expect(core.setOutput).toHaveBeenCalledWith('updated-dependencies-json', updatedDependencies)
102102

103-
expect(core.setOutput).toBeCalledWith('dependency-names', 'rspec, coffee-rails, coffeescript, rspec-coffeescript')
104-
expect(core.setOutput).toBeCalledWith('dependency-type', 'direct:development')
105-
expect(core.setOutput).toBeCalledWith('update-type', 'version-update:semver-major')
106-
expect(core.setOutput).toBeCalledWith('directory', '')
107-
expect(core.setOutput).toBeCalledWith('package-ecosystem', '')
108-
expect(core.setOutput).toBeCalledWith('target-branch', '')
109-
expect(core.setOutput).toBeCalledWith('previous-version', '')
110-
expect(core.setOutput).toBeCalledWith('new-version', '')
111-
expect(core.setOutput).toBeCalledWith('compatibility-score', 0)
112-
expect(core.setOutput).toBeCalledWith('alert-state', '')
113-
expect(core.setOutput).toBeCalledWith('ghsa-id', '')
114-
expect(core.setOutput).toBeCalledWith('cvss', 0)
103+
expect(core.setOutput).toHaveBeenCalledWith('dependency-names', 'rspec, coffee-rails, coffeescript, rspec-coffeescript')
104+
expect(core.setOutput).toHaveBeenCalledWith('dependency-type', 'direct:development')
105+
expect(core.setOutput).toHaveBeenCalledWith('update-type', 'version-update:semver-major')
106+
expect(core.setOutput).toHaveBeenCalledWith('directory', '')
107+
expect(core.setOutput).toHaveBeenCalledWith('package-ecosystem', '')
108+
expect(core.setOutput).toHaveBeenCalledWith('target-branch', '')
109+
expect(core.setOutput).toHaveBeenCalledWith('previous-version', '')
110+
expect(core.setOutput).toHaveBeenCalledWith('new-version', '')
111+
expect(core.setOutput).toHaveBeenCalledWith('compatibility-score', 0)
112+
expect(core.setOutput).toHaveBeenCalledWith('alert-state', '')
113+
expect(core.setOutput).toHaveBeenCalledWith('ghsa-id', '')
114+
expect(core.setOutput).toHaveBeenCalledWith('cvss', 0)
115115
})
116116

117117
test('when the dependency has no update type', async () => {
@@ -131,18 +131,18 @@ test('when the dependency has no update type', async () => {
131131

132132
expect(core.setOutput).toHaveBeenCalledWith('updated-dependencies-json', updatedDependencies)
133133

134-
expect(core.setOutput).toBeCalledWith('dependency-names', 'coffee-rails')
135-
expect(core.setOutput).toBeCalledWith('dependency-type', 'direct:production')
136-
expect(core.setOutput).toBeCalledWith('update-type', null)
137-
expect(core.setOutput).toBeCalledWith('directory', '')
138-
expect(core.setOutput).toBeCalledWith('package-ecosystem', '')
139-
expect(core.setOutput).toBeCalledWith('target-branch', '')
140-
expect(core.setOutput).toBeCalledWith('previous-version', '')
141-
expect(core.setOutput).toBeCalledWith('new-version', '')
142-
expect(core.setOutput).toBeCalledWith('compatibility-score', 0)
143-
expect(core.setOutput).toBeCalledWith('alert-state', '')
144-
expect(core.setOutput).toBeCalledWith('ghsa-id', '')
145-
expect(core.setOutput).toBeCalledWith('cvss', 0)
134+
expect(core.setOutput).toHaveBeenCalledWith('dependency-names', 'coffee-rails')
135+
expect(core.setOutput).toHaveBeenCalledWith('dependency-type', 'direct:production')
136+
expect(core.setOutput).toHaveBeenCalledWith('update-type', null)
137+
expect(core.setOutput).toHaveBeenCalledWith('directory', '')
138+
expect(core.setOutput).toHaveBeenCalledWith('package-ecosystem', '')
139+
expect(core.setOutput).toHaveBeenCalledWith('target-branch', '')
140+
expect(core.setOutput).toHaveBeenCalledWith('previous-version', '')
141+
expect(core.setOutput).toHaveBeenCalledWith('new-version', '')
142+
expect(core.setOutput).toHaveBeenCalledWith('compatibility-score', 0)
143+
expect(core.setOutput).toHaveBeenCalledWith('alert-state', '')
144+
expect(core.setOutput).toHaveBeenCalledWith('ghsa-id', '')
145+
expect(core.setOutput).toHaveBeenCalledWith('cvss', 0)
146146
})
147147

148148
test('when given a multiple dependencies, and some do not have update types', async () => {
@@ -175,16 +175,16 @@ test('when given a multiple dependencies, and some do not have update types', as
175175

176176
expect(core.setOutput).toHaveBeenCalledWith('updated-dependencies-json', updatedDependencies)
177177

178-
expect(core.setOutput).toBeCalledWith('dependency-names', 'rspec, coffee-rails, coffeescript, rspec-coffeescript')
179-
expect(core.setOutput).toBeCalledWith('dependency-type', 'direct:development')
180-
expect(core.setOutput).toBeCalledWith('update-type', 'version-update:semver-minor')
181-
expect(core.setOutput).toBeCalledWith('directory', '')
182-
expect(core.setOutput).toBeCalledWith('package-ecosystem', '')
183-
expect(core.setOutput).toBeCalledWith('target-branch', '')
184-
expect(core.setOutput).toBeCalledWith('previous-version', '')
185-
expect(core.setOutput).toBeCalledWith('new-version', '')
186-
expect(core.setOutput).toBeCalledWith('compatibility-score', 0)
187-
expect(core.setOutput).toBeCalledWith('alert-state', '')
188-
expect(core.setOutput).toBeCalledWith('ghsa-id', '')
189-
expect(core.setOutput).toBeCalledWith('cvss', 0)
178+
expect(core.setOutput).toHaveBeenCalledWith('dependency-names', 'rspec, coffee-rails, coffeescript, rspec-coffeescript')
179+
expect(core.setOutput).toHaveBeenCalledWith('dependency-type', 'direct:development')
180+
expect(core.setOutput).toHaveBeenCalledWith('update-type', 'version-update:semver-minor')
181+
expect(core.setOutput).toHaveBeenCalledWith('directory', '')
182+
expect(core.setOutput).toHaveBeenCalledWith('package-ecosystem', '')
183+
expect(core.setOutput).toHaveBeenCalledWith('target-branch', '')
184+
expect(core.setOutput).toHaveBeenCalledWith('previous-version', '')
185+
expect(core.setOutput).toHaveBeenCalledWith('new-version', '')
186+
expect(core.setOutput).toHaveBeenCalledWith('compatibility-score', 0)
187+
expect(core.setOutput).toHaveBeenCalledWith('alert-state', '')
188+
expect(core.setOutput).toHaveBeenCalledWith('ghsa-id', '')
189+
expect(core.setOutput).toHaveBeenCalledWith('cvss', 0)
190190
})

src/main.test.ts

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -133,20 +133,20 @@ test('it sets the updated dependency as an output for subsequent actions when gi
133133
]
134134
)
135135

136-
expect(core.setOutput).toBeCalledWith('dependency-names', 'coffee-rails')
137-
expect(core.setOutput).toBeCalledWith('dependency-type', 'direct:production')
138-
expect(core.setOutput).toBeCalledWith('update-type', 'version-update:semver-minor')
139-
expect(core.setOutput).toBeCalledWith('directory', '/')
140-
expect(core.setOutput).toBeCalledWith('package-ecosystem', 'nuget')
141-
expect(core.setOutput).toBeCalledWith('target-branch', 'main')
142-
expect(core.setOutput).toBeCalledWith('previous-version', '4.0.1')
143-
expect(core.setOutput).toBeCalledWith('new-version', '4.2.2')
144-
expect(core.setOutput).toBeCalledWith('compatibility-score', 0)
145-
expect(core.setOutput).toBeCalledWith('maintainer-changes', false)
146-
expect(core.setOutput).toBeCalledWith('dependency-group', '')
147-
expect(core.setOutput).toBeCalledWith('alert-state', '')
148-
expect(core.setOutput).toBeCalledWith('ghsa-id', '')
149-
expect(core.setOutput).toBeCalledWith('cvss', 0)
136+
expect(core.setOutput).toHaveBeenCalledWith('dependency-names', 'coffee-rails')
137+
expect(core.setOutput).toHaveBeenCalledWith('dependency-type', 'direct:production')
138+
expect(core.setOutput).toHaveBeenCalledWith('update-type', 'version-update:semver-minor')
139+
expect(core.setOutput).toHaveBeenCalledWith('directory', '/')
140+
expect(core.setOutput).toHaveBeenCalledWith('package-ecosystem', 'nuget')
141+
expect(core.setOutput).toHaveBeenCalledWith('target-branch', 'main')
142+
expect(core.setOutput).toHaveBeenCalledWith('previous-version', '4.0.1')
143+
expect(core.setOutput).toHaveBeenCalledWith('new-version', '4.2.2')
144+
expect(core.setOutput).toHaveBeenCalledWith('compatibility-score', 0)
145+
expect(core.setOutput).toHaveBeenCalledWith('maintainer-changes', false)
146+
expect(core.setOutput).toHaveBeenCalledWith('dependency-group', '')
147+
expect(core.setOutput).toHaveBeenCalledWith('alert-state', '')
148+
expect(core.setOutput).toHaveBeenCalledWith('ghsa-id', '')
149+
expect(core.setOutput).toHaveBeenCalledWith('cvss', 0)
150150
})
151151

152152
test('it sets the updated dependency as an output for subsequent actions when there is a leading v in the commit message version', async () => {
@@ -206,20 +206,20 @@ test('it sets the updated dependency as an output for subsequent actions when th
206206
]
207207
)
208208

209-
expect(core.setOutput).toBeCalledWith('dependency-names', 'coffee-rails')
210-
expect(core.setOutput).toBeCalledWith('dependency-type', 'direct:production')
211-
expect(core.setOutput).toBeCalledWith('update-type', 'version-update:semver-minor')
212-
expect(core.setOutput).toBeCalledWith('directory', '/')
213-
expect(core.setOutput).toBeCalledWith('package-ecosystem', 'nuget')
214-
expect(core.setOutput).toBeCalledWith('target-branch', 'main')
215-
expect(core.setOutput).toBeCalledWith('previous-version', 'v4.0.1')
216-
expect(core.setOutput).toBeCalledWith('new-version', 'v4.2.2')
217-
expect(core.setOutput).toBeCalledWith('compatibility-score', 0)
218-
expect(core.setOutput).toBeCalledWith('maintainer-changes', false)
219-
expect(core.setOutput).toBeCalledWith('dependency-group', '')
220-
expect(core.setOutput).toBeCalledWith('alert-state', '')
221-
expect(core.setOutput).toBeCalledWith('ghsa-id', '')
222-
expect(core.setOutput).toBeCalledWith('cvss', 0)
209+
expect(core.setOutput).toHaveBeenCalledWith('dependency-names', 'coffee-rails')
210+
expect(core.setOutput).toHaveBeenCalledWith('dependency-type', 'direct:production')
211+
expect(core.setOutput).toHaveBeenCalledWith('update-type', 'version-update:semver-minor')
212+
expect(core.setOutput).toHaveBeenCalledWith('directory', '/')
213+
expect(core.setOutput).toHaveBeenCalledWith('package-ecosystem', 'nuget')
214+
expect(core.setOutput).toHaveBeenCalledWith('target-branch', 'main')
215+
expect(core.setOutput).toHaveBeenCalledWith('previous-version', 'v4.0.1')
216+
expect(core.setOutput).toHaveBeenCalledWith('new-version', 'v4.2.2')
217+
expect(core.setOutput).toHaveBeenCalledWith('compatibility-score', 0)
218+
expect(core.setOutput).toHaveBeenCalledWith('maintainer-changes', false)
219+
expect(core.setOutput).toHaveBeenCalledWith('dependency-group', '')
220+
expect(core.setOutput).toHaveBeenCalledWith('alert-state', '')
221+
expect(core.setOutput).toHaveBeenCalledWith('ghsa-id', '')
222+
expect(core.setOutput).toHaveBeenCalledWith('cvss', 0)
223223
})
224224

225225
test('it supports returning information about grouped updates', async () => {
@@ -390,20 +390,20 @@ test('it sets the updated dependency as an output for subsequent actions when gi
390390
]
391391
)
392392

393-
expect(core.setOutput).toBeCalledWith('dependency-names', 'rubocop')
394-
expect(core.setOutput).toBeCalledWith('dependency-type', 'direct:development')
395-
expect(core.setOutput).toBeCalledWith('update-type', 'version-update:semver-minor')
396-
expect(core.setOutput).toBeCalledWith('directory', '/')
397-
expect(core.setOutput).toBeCalledWith('package-ecosystem', 'bundler')
398-
expect(core.setOutput).toBeCalledWith('target-branch', 'main')
399-
expect(core.setOutput).toBeCalledWith('previous-version', '1.30.1')
400-
expect(core.setOutput).toBeCalledWith('new-version', '1.31.0')
401-
expect(core.setOutput).toBeCalledWith('compatibility-score', 0)
402-
expect(core.setOutput).toBeCalledWith('maintainer-changes', false)
403-
expect(core.setOutput).toBeCalledWith('dependency-group', '')
404-
expect(core.setOutput).toBeCalledWith('alert-state', '')
405-
expect(core.setOutput).toBeCalledWith('ghsa-id', '')
406-
expect(core.setOutput).toBeCalledWith('cvss', 0)
393+
expect(core.setOutput).toHaveBeenCalledWith('dependency-names', 'rubocop')
394+
expect(core.setOutput).toHaveBeenCalledWith('dependency-type', 'direct:development')
395+
expect(core.setOutput).toHaveBeenCalledWith('update-type', 'version-update:semver-minor')
396+
expect(core.setOutput).toHaveBeenCalledWith('directory', '/')
397+
expect(core.setOutput).toHaveBeenCalledWith('package-ecosystem', 'bundler')
398+
expect(core.setOutput).toHaveBeenCalledWith('target-branch', 'main')
399+
expect(core.setOutput).toHaveBeenCalledWith('previous-version', '1.30.1')
400+
expect(core.setOutput).toHaveBeenCalledWith('new-version', '1.31.0')
401+
expect(core.setOutput).toHaveBeenCalledWith('compatibility-score', 0)
402+
expect(core.setOutput).toHaveBeenCalledWith('maintainer-changes', false)
403+
expect(core.setOutput).toHaveBeenCalledWith('dependency-group', '')
404+
expect(core.setOutput).toHaveBeenCalledWith('alert-state', '')
405+
expect(core.setOutput).toHaveBeenCalledWith('ghsa-id', '')
406+
expect(core.setOutput).toHaveBeenCalledWith('cvss', 0)
407407
})
408408

409409
test('if there are multiple dependencies, it summarizes them', async () => {
@@ -484,20 +484,20 @@ test('if there are multiple dependencies, it summarizes them', async () => {
484484
]
485485
)
486486

487-
expect(core.setOutput).toBeCalledWith('dependency-names', 'coffee-rails, coffeescript')
488-
expect(core.setOutput).toBeCalledWith('dependency-type', 'direct:production')
489-
expect(core.setOutput).toBeCalledWith('update-type', 'version-update:semver-major')
490-
expect(core.setOutput).toBeCalledWith('directory', '/api/main')
491-
expect(core.setOutput).toBeCalledWith('package-ecosystem', 'npm_and_yarn')
492-
expect(core.setOutput).toBeCalledWith('target-branch', 'trunk')
493-
expect(core.setOutput).toBeCalledWith('previous-version', '4.0.1')
494-
expect(core.setOutput).toBeCalledWith('new-version', '4.2.2')
495-
expect(core.setOutput).toBeCalledWith('compatibility-score', 34)
496-
expect(core.setOutput).toBeCalledWith('maintainer-changes', false)
497-
expect(core.setOutput).toBeCalledWith('dependency-group', '')
498-
expect(core.setOutput).toBeCalledWith('alert-state', '')
499-
expect(core.setOutput).toBeCalledWith('ghsa-id', '')
500-
expect(core.setOutput).toBeCalledWith('cvss', 0)
487+
expect(core.setOutput).toHaveBeenCalledWith('dependency-names', 'coffee-rails, coffeescript')
488+
expect(core.setOutput).toHaveBeenCalledWith('dependency-type', 'direct:production')
489+
expect(core.setOutput).toHaveBeenCalledWith('update-type', 'version-update:semver-major')
490+
expect(core.setOutput).toHaveBeenCalledWith('directory', '/api/main')
491+
expect(core.setOutput).toHaveBeenCalledWith('package-ecosystem', 'npm_and_yarn')
492+
expect(core.setOutput).toHaveBeenCalledWith('target-branch', 'trunk')
493+
expect(core.setOutput).toHaveBeenCalledWith('previous-version', '4.0.1')
494+
expect(core.setOutput).toHaveBeenCalledWith('new-version', '4.2.2')
495+
expect(core.setOutput).toHaveBeenCalledWith('compatibility-score', 34)
496+
expect(core.setOutput).toHaveBeenCalledWith('maintainer-changes', false)
497+
expect(core.setOutput).toHaveBeenCalledWith('dependency-group', '')
498+
expect(core.setOutput).toHaveBeenCalledWith('alert-state', '')
499+
expect(core.setOutput).toHaveBeenCalledWith('ghsa-id', '')
500+
expect(core.setOutput).toHaveBeenCalledWith('cvss', 0)
501501
})
502502

503503
test('it sets the action to failed if there is an unexpected exception', async () => {

0 commit comments

Comments
 (0)