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
*/
export const addMember = function (className, member) {
console.log(className, member);
const validatedClassName = splitClassNameAndType(className).className;
const theClass = classes[validatedClassName];

View File

@ -110,14 +110,13 @@ describe('class diagram, ', function () {
' flightNumber : Integer\n' +
' departureTime : Date\n' +
'}';
let testPased = false;
let testPassed = false;
try {
parser.parse(str);
} catch (error) {
console.log(error.name);
testPased = true;
testPassed = 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 () {
@ -129,14 +128,13 @@ describe('class diagram, ', function () {
'}\n' +
'\n' +
'class Dummy_Class {\n';
let testPased = false;
let testPassed = false;
try {
parser.parse(str);
} catch (error) {
console.log(error.name);
testPased = true;
testPassed = true;
}
expect(testPased).toBe(true);
expect(testPassed).toBe(true);
});
it('should handle generic class with brackets', function () {

View File

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

View File

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

View File

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

View File

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

View File

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