@@ -45,6 +45,15 @@ describe('GenericJson', () => {
4545 const newContent = updater . updateContent ( oldContent ) ;
4646 snapshot ( newContent ) ;
4747 } ) ;
48+ it ( 'updates substring in matching entry' , async ( ) => {
49+ const oldContent = readFileSync (
50+ resolve ( fixturesPath , './renovate-shared-preset.json' ) ,
51+ 'utf8'
52+ ) . replace ( / \r \n / g, '\n' ) ;
53+ const updater = new GenericJson ( '$.extends.*' , Version . parse ( 'v2.3.4' ) ) ;
54+ const newContent = updater . updateContent ( oldContent ) ;
55+ snapshot ( newContent ) ;
56+ } ) ;
4857 it ( 'ignores non-matching entry' , async ( ) => {
4958 const oldContent = readFileSync (
5059 resolve ( fixturesPath , './esy.json' ) ,
@@ -54,6 +63,24 @@ describe('GenericJson', () => {
5463 const newContent = updater . updateContent ( oldContent ) ;
5564 expect ( newContent ) . to . eql ( oldContent ) ;
5665 } ) ;
66+ it ( 'ignore array entry' , async ( ) => {
67+ const oldContent = readFileSync (
68+ resolve ( fixturesPath , './renovate-shared-preset.json' ) ,
69+ 'utf8'
70+ ) . replace ( / \r \n / g, '\n' ) ;
71+ const updater = new GenericJson ( '$.extends' , Version . parse ( 'v2.3.4' ) ) ;
72+ const newContent = updater . updateContent ( oldContent ) ;
73+ expect ( newContent ) . to . eql ( oldContent ) ;
74+ } ) ;
75+ it ( 'ignore non-matching string' , async ( ) => {
76+ const oldContent = readFileSync (
77+ resolve ( fixturesPath , './esy.json' ) ,
78+ 'utf8'
79+ ) . replace ( / \r \n / g, '\n' ) ;
80+ const updater = new GenericJson ( '$.author' , Version . parse ( 'v2.3.4' ) ) ;
81+ const newContent = updater . updateContent ( oldContent ) ;
82+ expect ( newContent ) . to . eql ( oldContent ) ;
83+ } ) ;
5784 it ( 'warns on invalid jsonpath' , async ( ) => {
5885 const oldContent = readFileSync (
5986 resolve ( fixturesPath , './esy.json' ) ,
0 commit comments