Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test for view.prototype.render #6306

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

KovacevicAleksa
Copy link

Test for view.prototype.render

view.js (133-159 line)
Before:
Screenshot From 2025-01-31 14-36-13
After:
Screenshot From 2025-01-31 14-41-06

@@ -365,6 +366,99 @@ describe('app', function(){
})
})

describe('View.prototype.render', function () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically we put tests for sub systems into their own files. I have not fully read these new tests, but before I do can you move them into a new test file? The pattern for the others is to use the same file name, so in this case view.js.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think like this?

test/view.js Outdated


describe('View.prototype.render', function () {
it('should force callback to be async and pass correct arguments', function (done) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think this test is correct. I would need to play around locally to be sure (which I didn't do), but your mockEngine is not asnyc and I am not sure this test even makes sense if it was. Can you describe what you are trying to prove with this isAsync part of the test?

test/view.js Outdated
defaultEngine: '.tmpl'
});

var isAsync = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As with the one above, I dont think this isAsync stuff is doing anything meaningful. Can you describe what you are going for here to help me understand?

test/view.js Outdated

it('should pass correct arguments to the engine', function (done) {
var mockEngine = function (filePath, options, callback) {
assert.strictEqual(filePath, view.path, 'File path should match');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assertion is a self fulfilling test. If you want to test this properly you would need to hard code the expected path here, not use view.path since no matter what we changed view.path to this would pass. right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants