File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ describe("XML Patcher", () => {
3737
3838 expect ( result ) . toEqual ( '<rootNode><name>a name</name><childNode size="42"><leaf color="#aaaaaa"/><leaf color="#000000"/></childNode></rootNode>' ) ;
3939 } ) ;
40-
40+
4141 it ( ": should support basic node content replace." , ( ) => {
4242 var patcher = new xmlatcher . XmlPatcher ( [
4343 {
@@ -87,4 +87,30 @@ describe("XML Patcher", () => {
8787 } ) ;
8888 } ) ;
8989 } ) ;
90+
91+ describe ( "Regression tests" , ( ) => {
92+ it ( ": test #22 find by attribute value is working properly" , ( ) => {
93+ var source = '<?xml version="1.0" encoding="utf-8"?> \
94+ <configuration> \
95+ <connectionStrings> \
96+ <add name="db" connectionString="Data Source=local_dev;Database=Internal_DEV;Type System Version=SQL Server 2012;User ID=someone;Password=something;Persist Security Info=True" providerName="System.Data.SqlClient" /> \
97+ <add name="example" connectionString="Data Source=xx;Database=xx;Type System Version=SQL Server 2012;User ID=xx;Password=xx;Persist Security Info=True" providerName="System.Data.SqlClient" /> \
98+ </connectionStrings> \
99+ <appSettings> \
100+ <!-- Specify a super user name, for example \
101+ <add key="SuperUser" value="US\jshkolnik" /> \
102+ --> \
103+ <add key="SuperUser" value="#should_be_replaced#" /> \
104+ </appSettings> \
105+ </configuration>' ;
106+ var patcher = new xmlatcher . XmlPatcher ( [
107+ {
108+ op : "replace" , path : "/configuration/appSettings/add[@key='SuperUser']/@value" , value : "a value"
109+ }
110+ ] , { } ) ;
111+ var result = patcher . apply ( source ) ;
112+ console . log ( result ) ;
113+ expect ( result ) . not . toContain ( '#should_be_replaced#' ) ;
114+ } ) ;
115+ } ) ;
90116} ) ;
You can’t perform that action at this time.
0 commit comments