chore: reduce excessive logs in unit tests

This commit is contained in:
Yash-Singh1
2022-05-10 17:04:22 -07:00
parent 8394bcd4a9
commit bc58c8e03c
7 changed files with 6 additions and 20 deletions

View File

@@ -142,7 +142,6 @@ export const addAnnotation = function (className, annotation) {
* @public * @public
*/ */
export const addMember = function (className, member) { export const addMember = function (className, member) {
console.log(className, member);
const validatedClassName = splitClassNameAndType(className).className; const validatedClassName = splitClassNameAndType(className).className;
const theClass = classes[validatedClassName]; const theClass = classes[validatedClassName];

View File

@@ -110,14 +110,13 @@ describe('class diagram, ', function () {
' flightNumber : Integer\n' + ' flightNumber : Integer\n' +
' departureTime : Date\n' + ' departureTime : Date\n' +
'}'; '}';
let testPased = false; let testPassed = false;
try { try {
parser.parse(str); parser.parse(str);
} catch (error) { } catch (error) {
console.log(error.name); testPassed = true;
testPased = true;
} }
expect(testPased).toBe(true); expect(testPassed).toBe(true);
}); });
it('should break when EOF is encountered before closing the first `{` while defining generic class with brackets', function () { it('should break when EOF is encountered before closing the first `{` while defining generic class with brackets', function () {
@@ -129,14 +128,13 @@ describe('class diagram, ', function () {
'}\n' + '}\n' +
'\n' + '\n' +
'class Dummy_Class {\n'; 'class Dummy_Class {\n';
let testPased = false; let testPassed = false;
try { try {
parser.parse(str); parser.parse(str);
} catch (error) { } catch (error) {
console.log(error.name); testPassed = true;
testPased = true;
} }
expect(testPased).toBe(true); expect(testPassed).toBe(true);
}); });
it('should handle generic class with brackets', function () { it('should handle generic class with brackets', function () {

View File

@@ -100,7 +100,6 @@ describe('Sanitize text', function () {
securityLevel: 'strict', securityLevel: 'strict',
flowchart: { htmlLabels: true }, flowchart: { htmlLabels: true },
}); });
console.log('result', result);
expect(result).not.toContain('javascript:alert(1)'); expect(result).not.toContain('javascript:alert(1)');
}); });
}); });

View File

@@ -188,7 +188,6 @@ describe('parsing a flow chart', function () {
flow.parser.parse(flowChart); flow.parser.parse(flowChart);
expect(flow.parser.yy.getTitle()).toBe('Big decisions'); expect(flow.parser.yy.getTitle()).toBe('Big decisions');
console.log(flow.parser.yy.getAccDescription());
expect(flow.parser.yy.getAccDescription()).toBe( expect(flow.parser.yy.getAccDescription()).toBe(
`Flow chart of the decision making process `Flow chart of the decision making process
with a second line` with a second line`

View File

@@ -40,7 +40,6 @@ describe('when parsing a gitGraph', function () {
const str = `gitGraph: const str = `gitGraph:
commit id:"1111" commit id:"1111"
`; `;
//console.log(str);
parser.parse(str); parser.parse(str);
const commits = parser.yy.getCommits(); const commits = parser.yy.getCommits();
expect(Object.keys(commits).length).toBe(1); expect(Object.keys(commits).length).toBe(1);
@@ -449,9 +448,6 @@ describe('when parsing a gitGraph', function () {
const commit3 = Object.keys(commits)[2]; const commit3 = Object.keys(commits)[2];
const commit4 = Object.keys(commits)[3]; const commit4 = Object.keys(commits)[3];
expect(commits[commit1].branch).toBe('main'); expect(commits[commit1].branch).toBe('main');
console.log(commits);
console.log(commits[commit1].parents);
expect(commits[commit1].parents).toStrictEqual([]); expect(commits[commit1].parents).toStrictEqual([]);
expect(commits[commit2].branch).toBe('testBranch'); expect(commits[commit2].branch).toBe('testBranch');
expect(commits[commit2].parents).toStrictEqual([commits[commit1].id]); expect(commits[commit2].parents).toStrictEqual([commits[commit1].id]);

View File

@@ -423,7 +423,6 @@ deactivate Bob`;
try { try {
mermaidAPI.parse(str); mermaidAPI.parse(str);
} catch (e) { } catch (e) {
console.log(e.hash);
error = true; error = true;
} }
expect(error).toBe(true); expect(error).toBe(true);
@@ -1024,7 +1023,6 @@ link a: Endpoint @ https://alice.contoso.com
link a: Swagger @ https://swagger.contoso.com link a: Swagger @ https://swagger.contoso.com
link a: Tests @ https://tests.contoso.com/?svc=alice@contoso.com link a: Tests @ https://tests.contoso.com/?svc=alice@contoso.com
`; `;
console.log(str);
mermaidAPI.parse(str); mermaidAPI.parse(str);
const actors = parser.yy.getActors(); const actors = parser.yy.getActors();
@@ -1049,7 +1047,6 @@ participant c as Charlie
properties a: {"class": "internal-service-actor", "icon": "@clock"} properties a: {"class": "internal-service-actor", "icon": "@clock"}
properties b: {"class": "external-service-actor", "icon": "@computer"} properties b: {"class": "external-service-actor", "icon": "@computer"}
`; `;
console.log(str);
mermaidAPI.parse(str); mermaidAPI.parse(str);
const actors = parser.yy.getActors(); const actors = parser.yy.getActors();

View File

@@ -128,13 +128,11 @@ describe('svgDraw', function () {
it('it should sanitize malicious urls', function () { it('it should sanitize malicious urls', function () {
const maliciousStr = 'javascript:script:alert(1)'; const maliciousStr = 'javascript:script:alert(1)';
const result = svgDraw.sanitizeUrl(maliciousStr); const result = svgDraw.sanitizeUrl(maliciousStr);
console.log('result', result);
expect(result).not.toContain('javascript:alert(1)'); expect(result).not.toContain('javascript:alert(1)');
}); });
it('it should not sanitize non dangerous urls', function () { it('it should not sanitize non dangerous urls', function () {
const maliciousStr = 'javajavascript:script:alert(1)'; const maliciousStr = 'javajavascript:script:alert(1)';
const result = svgDraw.sanitizeUrl(maliciousStr); const result = svgDraw.sanitizeUrl(maliciousStr);
console.log('result', result);
expect(result).not.toContain('javascript:alert(1)'); expect(result).not.toContain('javascript:alert(1)');
}); });
}); });