@@ -23,6 +23,7 @@ import snapshot = require('snap-shot-it');
2323import {
2424 dateSafe ,
2525 assertHasUpdate ,
26+ assertHasUpdates ,
2627 buildMockConventionalCommit ,
2728} from '../helpers' ;
2829import { GenericJson } from '../../src/updaters/generic-json' ;
@@ -112,6 +113,70 @@ describe('Strategy', () => {
112113 ] )
113114 . and . not . include ( 'foo/baz/bar/' , 'expected file but got directory' ) ;
114115 } ) ;
116+ it ( 'updates extra JSON files with default' , async ( ) => {
117+ const strategy = new TestStrategy ( {
118+ targetBranch : 'main' ,
119+ github,
120+ component : 'google-cloud-automl' ,
121+ extraFiles : [ 'manifest.json' ] ,
122+ } ) ;
123+ const pullRequest = await strategy . buildReleasePullRequest (
124+ buildMockConventionalCommit ( 'fix: a bugfix' ) ,
125+ undefined
126+ ) ;
127+ expect ( pullRequest ) . to . exist ;
128+ const updates = pullRequest ?. updates ;
129+ expect ( updates ) . to . be . an ( 'array' ) ;
130+ assertHasUpdates ( updates ! , 'manifest.json' , GenericJson , Generic ) ;
131+ } ) ;
132+ it ( 'updates extra YAML files with default' , async ( ) => {
133+ const strategy = new TestStrategy ( {
134+ targetBranch : 'main' ,
135+ github,
136+ component : 'google-cloud-automl' ,
137+ extraFiles : [ 'pubspec.yaml' ] ,
138+ } ) ;
139+ const pullRequest = await strategy . buildReleasePullRequest (
140+ buildMockConventionalCommit ( 'fix: a bugfix' ) ,
141+ undefined
142+ ) ;
143+ expect ( pullRequest ) . to . exist ;
144+ const updates = pullRequest ?. updates ;
145+ expect ( updates ) . to . be . an ( 'array' ) ;
146+ assertHasUpdates ( updates ! , 'pubspec.yaml' , GenericYaml , Generic ) ;
147+ } ) ;
148+ it ( 'updates extra TOML files with default' , async ( ) => {
149+ const strategy = new TestStrategy ( {
150+ targetBranch : 'main' ,
151+ github,
152+ component : 'google-cloud-automl' ,
153+ extraFiles : [ 'foo.toml' ] ,
154+ } ) ;
155+ const pullRequest = await strategy . buildReleasePullRequest (
156+ buildMockConventionalCommit ( 'fix: a bugfix' ) ,
157+ undefined
158+ ) ;
159+ expect ( pullRequest ) . to . exist ;
160+ const updates = pullRequest ?. updates ;
161+ expect ( updates ) . to . be . an ( 'array' ) ;
162+ assertHasUpdates ( updates ! , 'foo.toml' , GenericToml , Generic ) ;
163+ } ) ;
164+ it ( 'updates extra Xml files with default' , async ( ) => {
165+ const strategy = new TestStrategy ( {
166+ targetBranch : 'main' ,
167+ github,
168+ component : 'google-cloud-automl' ,
169+ extraFiles : [ 'pom.xml' ] ,
170+ } ) ;
171+ const pullRequest = await strategy . buildReleasePullRequest (
172+ buildMockConventionalCommit ( 'fix: a bugfix' ) ,
173+ undefined
174+ ) ;
175+ expect ( pullRequest ) . to . exist ;
176+ const updates = pullRequest ?. updates ;
177+ expect ( updates ) . to . be . an ( 'array' ) ;
178+ assertHasUpdates ( updates ! , 'pom.xml' , GenericXml , Generic ) ;
179+ } ) ;
115180 it ( 'updates extra JSON files' , async ( ) => {
116181 const strategy = new TestStrategy ( {
117182 targetBranch : 'main' ,
0 commit comments