@@ -127,7 +127,7 @@ describe('updateRequirement', () => {
127127 } )
128128
129129 describe ( 'rule is custom' , ( ) => {
130- it ( 'returns stuff ' , async ( ) => {
130+ it ( 'reports on custom updates ' , async ( ) => {
131131 const requirement = toPairs ( {
132132 TestRequirement : [ { rule : 'custom' , plugin : 'Example Plugin' , name : 'checkThing' } ] ,
133133 } ) [ 0 ]
@@ -136,6 +136,40 @@ describe('updateRequirement', () => {
136136 expect ( result ) . toEqual ( [ "Setting checkThing 'semver' to '12.0.0'" ] )
137137 expect ( spinner . stop . mock . calls . length ) . toEqual ( 1 )
138138 } )
139+
140+ it ( 'reports correctly on multiple updates' , async ( ) => {
141+ const requirement = toPairs ( {
142+ TestRequirement : [ { rule : 'custom' , plugin : 'Example Plugin' , name : 'checkSecondThing' } ] ,
143+ } ) [ 0 ]
144+
145+ const result = await updateRequirement ( requirement , settings , context )
146+ expect ( result ) . toEqual ( [ "Setting checkSecondThing 'semver' to '12.0.0', 'nachos' to 'true'" ] )
147+ expect ( spinner . stop . mock . calls . length ) . toEqual ( 1 )
148+ } )
149+
150+ it ( 'reports correctly on NO updates' , async ( ) => {
151+ const requirement = toPairs ( {
152+ TestRequirement : [ { rule : 'custom' , plugin : 'Example Plugin' , name : 'checkThirdThing' } ] ,
153+ } ) [ 0 ]
154+
155+ const result = await updateRequirement ( requirement , settings , context )
156+ expect ( result ) . toEqual ( [ [ ] ] )
157+ expect ( spinner . stop . mock . calls . length ) . toEqual ( 1 )
158+ } )
159+
160+ it ( 'custom combo - play nicely with others' , async ( ) => {
161+ const requirement = toPairs ( {
162+ TestRequirement : [
163+ { rule : 'custom' , plugin : 'Example Plugin' , name : 'checkThing' } ,
164+ { rule : 'custom' , plugin : 'Example Plugin' , name : 'checkSecondThing' } ,
165+ { rule : 'custom' , plugin : 'Example Plugin' , name : 'checkThirdThing' }
166+ ] ,
167+ } ) [ 0 ]
168+
169+ const result = await updateRequirement ( requirement , settings , context )
170+ expect ( result ) . toMatchSnapshot ( )
171+ expect ( spinner . stop . mock . calls . length ) . toEqual ( 1 )
172+ } )
139173 } )
140174
141175 describe ( 'rule: !== cli || custom' , ( ) => {
0 commit comments