Skip to content

Instantly share code, notes, and snippets.

@n370
Last active September 16, 2015 16:06
Show Gist options
  • Select an option

  • Save n370/84f58be0b350850fc77e to your computer and use it in GitHub Desktop.

Select an option

Save n370/84f58be0b350850fc77e to your computer and use it in GitHub Desktop.
An EJS template.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hacker Assessor</title>
</head>
<body>
<h1>This is the Hacker Assessor landing page</h1>
<h1><small>It features an awesome list of hackers.</small></h1>
<ul>
<% hackers.forEach(function(hacker){ %>
<li><a href="/hackers/<%= hacker.id %>"><%= hacker.name %></a></li>
<% }); %>
</ul>
</body>
</html>
@n370
Copy link
Author

n370 commented Sep 16, 2015

@rlemon Thank you for pointing that out. Guys on Freenode's #express channel also advised me to test only what matters and in this case go for a solution where I'm testing structure rather than strict format because most browsers will mess with my html somehow and people won't see it anyway.

So lesson learned. I appreciate your help on spotting where that new line came from. However I'll keep the original template structure for readability sake, changing my tests so they don't assert strict format but rather only what matters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment