Skip to content

Commit 78f3428

Browse files
committed
update testcase to cover result from esapi and owasp encoder library that are both valid
1 parent e3c19b7 commit 78f3428

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

test/functions/EncodeForXMLAttribute.cfc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
component extends="org.lucee.cfml.test.LuceeTestCase" labels="esapi,xml"{
1+
component extends="org.lucee.cfml.test.LuceeTestCase" labels="esapi"{
22
function run( testResults , testBox ) {
33
describe( "test case for EncodeForXMLAttribute", function() {
44
it(title = "Checking with EncodeForXMLAttribute", body = function( currentSpec ) {
55
var enc=EncodeForXMLAttribute('<script>');
6-
assertEquals('&##x3c;script&##x3e;',enc);
6+
assertEquals('&lt;script>',enc);
77
});
88

99
it(title = "Checking with EncodeForXMLAttributeMember", body = function( currentSpec ) {
1010
var enc='<script>'.EncodeForXMLAttribute();
11-
assertEquals('&##x3c;script&##x3e;',enc);
11+
assertEquals('&lt;script>',enc);
1212
});
1313
});
1414
}

test/functions/SanitizeHtml.cfc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ component extends="org.lucee.cfml.test.LuceeTestCase"{
44
describe( title = "Testcase for sanitizeHTML function", body = function() {
55
it( title = "checking sanitizeHTML() function", body = function( currentSpec ) {
66
var html = '<!DOCTYPE html><html><body><h2>HTML Forms</h2><form action="/action_page.cfm"><label for="fname">First name:</label><br><input type="text" id="fname" name="fname"value="Pothys"><br></body></html>';
7+
var res=SanitizeHtml(html);
78

8-
expect(SanitizeHtml(html)).toBe('<h2>HTML Forms</h2>First name:<br /><br />');
9-
expect(html.SanitizeHtml()).toBe('<h2>HTML Forms</h2>First name:<br /><br />'); // member function
9+
// cover result from esapi and owasp encoder library that are both valid
10+
var isValid = res=='<h2>HTML Forms</h2>First name:<br /><br />' || res=='<h2>HTML Forms</h2>First name:<br><br>';
11+
expect(isValid).toBe(true);
1012
});
1113
});
1214
}

0 commit comments

Comments
 (0)