Add tests

- Remove unused nl2br template helper
- Specify files to include in package
- Add nyc output folder to .gitignore
- Add render snapshot test
- Sort package.json fields
- Add test script
- Add tap dev dependency
This commit is contained in:
Rafael Bardini 2020-07-05 13:30:25 +02:00
parent 0b1af9c8f0
commit a737d2828a
7 changed files with 4036 additions and 9 deletions

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
node_modules/
.nyc_output
node_modules
npm-debug.log

View File

@ -26,7 +26,3 @@ Handlebars.registerHelper("join", function(arr, separator) {
separator = typeof separator === "string" ? separator : ", ";
return arr.join(separator);
});
Handlebars.registerHelper("nl2br", function(value) {
return (value || "").replace(/\n/g, "</p><p>");
});

3308
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,17 +2,28 @@
"name": "jsonresume-theme-even",
"version": "0.3.1",
"description": "A flat theme for JSON Resume, compatible with the bleeding edge resume schema",
"author": "Rafael Bardini",
"homepage": "https://github.com/rbardini/jsonresume-theme-even",
"bugs": {
"url": "https://github.com/rbardini/jsonresume-theme-even/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/rbardini/jsonresume-theme-even"
},
"bugs": {
"url": "https://github.com/rbardini/jsonresume-theme-even/issues"
},
"license": "MIT",
"author": "Rafael Bardini",
"files": [
"index.js",
"resume.hbs",
"style.css"
],
"scripts": {
"test": "tap"
},
"dependencies": {
"handlebars": "4.7.6"
},
"devDependencies": {
"tap": "14.10.7"
}
}

View File

@ -0,0 +1,541 @@
/* IMPORTANT
* This snapshot file is auto-generated, but designed for humans.
* It should be checked into source control and tracked carefully.
* Re-generate by setting TAP_SNAPSHOT=1 and running tests.
* Make sure to inspect the output below. Do not ignore changes!
*/
'use strict'
exports[`test/render.js TAP renders a resume > must match snapshot 1`] = `
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Richard Hendriks</title>
<meta name="description" content="Richard hails from Tulsa. He has earned degrees from the University of Oklahoma and Stanford. (Go Sooners and Cardinal!) Before starting Pied Piper, he worked for Hooli as a part time software developer. While his work focuses on applied information theory, mostly optimizing lossless compression schema of both the length-limited and adaptive variants, his non-work interests range widely, everything from quantum computing to chaos theory. He could tell you about it, but THAT would NOT be a “length-limited” conversation!" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700&display=swap" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" />
<style>
@font-face {
font-family: "Octicons";
font-style: normal;
font-weight: normal;
src: url("data:font/woff;base64,d09GRgABAAAAAAWgAAsAAAAABVQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABCAAAAGAAAABgDxIMrGNtYXAAAAFoAAAAXAAAAFzxE/EEZ2FzcAAAAcQAAAAIAAAACAAAABBnbHlmAAABzAAAAXwAAAF8tFkZ3GhlYWQAAANIAAAANgAAADYYMkpraGhlYQAAA4AAAAAkAAAAJAfBA8dobXR4AAADpAAAABgAAAAYDAAAAWxvY2EAAAO8AAAADgAAAA4A5gBgbWF4cAAAA8wAAAAgAAAAIAAKAFBuYW1lAAAD7AAAAZIAAAGSxxxndHBvc3QAAAWAAAAAIAAAACAAAwAAAAMCqwGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAA8NcDwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEAEAAAAAMAAgAAgAEAAEAIPBS8Nf//f//AAAAAAAg8FLw1//9//8AAf/jD7IPLgADAAEAAAAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAwAIAAsAAGwAAEzQ3PgE3NjMyFx4BFxYVFAcOAQcGIyInLgEnJgAUFEYvLjU1Li9GFBQUFEYvLjU1Li9GFB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BNAG8AbwBuAC4AAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") format("woff");
}
html {
font-size: 14px;
}
body {
background: #fff;
font-family: Lato, sans-serif;
margin: 0 0 6rem;
}
a {
color: #2ecc71;
}
a:focus,
a:hover {
color: #f1c40f;
text-decoration: none;
}
section {
margin-top: 2rem;
}
li {
line-height: 1.8;
list-style: none;
}
li:before {
content: "\\f052";
float: left;
font: 13px Octicons;
margin-top: 6px;
margin-left: -20px;
opacity: .1;
position: absolute;
}
blockquote {
border-left: 5px solid #e7e9ec;
font-size: 1rem;
}
em {
color: #95a5a6;
font-weight: normal;
font-style: normal;
}
h4 span:first-child {
font-weight: bold;
}
.container {
max-width: 750px;
padding: 0 2rem;
}
.col-sm-6 {
margin-bottom: 10px;
}
.col-sm-12 h4 {
margin-top: 1rem;
}
.col-sm-12 + .col-sm-12 {
margin-top: 2rem;
}
.keywords {
padding: 0;
}
.keywords > li {
display: inline-block;
background: #f4f6f6;
margin: 0 4px 4px 0;
padding: 2px 8px;
}
.keywords > li:before {
content: none;
}
#header {
background: #f4f6f6;
padding: 4rem 0;
margin-bottom: 4rem;
}
#header h2 {
color: #95a5a6;
}
#content h3 {
color: #f1c40f;
}
#content aside {
text-align: right;
padding-right: 2rem;
}
#work .position,
#volunteer .position {
font-weight: bold;
margin-bottom: 8px;
}
#education .area {
font-weight: bold;
}
#education .area:before {
content: "\\f0d7";
font: 16px Octicons;
margin-right: 6px;
vertical-align: bottom;
}
#education .studyType {
margin-left: 25px;
}
#awards .summary,
#publications .summary,
#projects .description {
margin-top: 8px;
}
#publications .website a:before {
content: attr(href);
}
#interests .row,
#skills .row {
display: block;
}
#interests .col-sm-6,
#skills .col-sm-6 {
float: left;
}
@media (min-width: 480px) {
.strike-through {
border-top: 1px solid #f4f6f6;
height: 20px;
margin-top: 12px;
margin-bottom: -2px;
position: relative;
}
.strike-through span,
.strike-through a {
background: #fff;
position: absolute;
}
.strike-through span:first-child {
padding-right: 20px;
margin-top: -12px;
}
.strike-through span + span {
font-size: 1rem;
margin-top: -10px;
padding-left: 20px;
right: 0;
}
}
@media (max-width: 768px) {
.col-sm-6:last-child {
margin-bottom: 0;
}
#content aside {
margin-bottom: 20px;
padding-right: 0;
text-align: left;
}
#publications .website a:before {
content: "View publication";
}
}
@media (max-width: 480px) {
.date {
font-size: 1rem;
}
.strike-through span:first-child {
margin-bottom: 7px;
}
.strike-through span {
display: block;
}
#header {
margin-bottom: 10px;
padding: 40px 0;
}
#actions {
display: none;
}
}
</style>
</head>
<body>
<header id="header">
<div class="container">
<div class="row">
<div class="col-sm-9 offset-sm-3">
<h1>Richard Hendriks</h1>
<h2>Programmer</h2>
</div>
</div>
</div>
</header>
<div id="content" class="container">
<section id="contact" class="row">
<aside class="col-sm-3">
<h3>Contact</h3>
</aside>
<div class="col-sm-9">
<div class="row">
<div class="col-sm-6">
<strong>Email</strong>
<div class="email">
<a href="mailto:richard.hendriks@mail.com">richard.hendriks@mail.com</a>
</div>
</div>
<div class="col-sm-6">
<strong>Phone</strong>
<div class="phone">
(912) 555-4321
</div>
</div>
<div class="col-sm-6">
<strong>Website</strong>
<div class="website">
<a href="http://richardhendricks.example.com">http://richardhendricks.example.com</a>
</div>
</div>
</div>
</div>
</section>
<section id="about" class="row">
<aside class="col-sm-3">
<h3>About</h3>
</aside>
<div class="col-sm-9">
<p>Richard hails from Tulsa. He has earned degrees from the University of Oklahoma and Stanford. (Go Sooners and Cardinal!) Before starting Pied Piper, he worked for Hooli as a part time software developer. While his work focuses on applied information theory, mostly optimizing lossless compression schema of both the length-limited and adaptive variants, his non-work interests range widely, everything from quantum computing to chaos theory. He could tell you about it, but THAT would NOT be a length-limited conversation!</p>
</div>
</section>
<section id="profiles" class="row">
<aside class="col-sm-3">
<h3>Profiles</h3>
</aside>
<div class="col-sm-9">
<div class="row">
<div class="col-sm-6">
<strong class="network">Twitter</strong>
<div class="username">
neutralthoughts
</div>
</div>
<div class="col-sm-6">
<strong class="network">SoundCloud</strong>
<div class="username">
<div class="url">
<a href="https://soundcloud.example.com/dandymusicnl">dandymusicnl</a>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="work" class="row">
<aside class="col-sm-3">
<h3>Work</h3>
</aside>
<div class="col-sm-9">
<div class="row">
<div class="col-sm-12">
<h4 class="strike-through">
<span>Pied Piper</span>
<span class="date">
Dec 2013 Dec 2014
</span>
</h4>
<div class="website float-right">
<a href="http://piedpiper.example.com">http://piedpiper.example.com</a>
</div>
<div class="position">
CEO/President
</div>
<div class="summary">
<p>Pied Piper is a multi-platform technology based on a proprietary universal compression algorithm that has consistently fielded high Weisman Scores that are not merely competitive, but approach the theoretical limit of lossless compression.</p>
</div>
<h4>Highlights</h4>
<ul class="highlights">
<li class="bullet">Build an algorithm for artist to detect if their music was violating copy right infringement laws</li>
<li class="bullet">Successfully won Techcrunch Disrupt</li>
<li class="bullet">Optimized an algorithm that holds the current world record for Weisman Scores</li>
</ul>
</div>
</div>
</div>
</section>
<section id="volunteer" class="row">
<aside class="col-sm-3">
<h3>Volunteer</h3>
</aside>
<div class="col-sm-9">
<div class="row">
<div class="col-sm-12">
<h4 class="strike-through">
<span>CoderDojo</span>
<span class="date">
Jan 2012 Jan 2013
</span>
</h4>
<div class="website float-right">
<a href="http://coderdojo.example.com/">http://coderdojo.example.com/</a>
</div>
<div class="position">
Teacher
</div>
<div class="summary">
<p>Global movement of free coding clubs for young people.</p>
</div>
<h4>Highlights</h4>
<ul class="highlights">
<li class="bullet">Awarded &#x27;Teacher of the Month&#x27;</li>
</ul>
</div>
</div>
</div>
</section>
<section id="education" class="row">
<aside class="col-sm-3">
<h3>Education</h3>
</aside>
<div class="col-sm-9">
<div class="row">
<div class="col-sm-12">
<h4 class="strike-through">
<span>University of Oklahoma</span>
<span class="date">
Jun 2011 Jan 2014
</span>
</h4>
<div class="website float-right">
<a href="https://www.ou.edu/">https://www.ou.edu/</a>
</div>
<div class="area">
Information Technology
</div>
<div class="studyType">
Bachelor
</div>
<h4>Courses</h4>
<ul class="courses">
<li>DB1101 - Basic SQL</li>
<li>CS2011 - Java Introduction</li>
</ul>
</div>
</div>
</div>
</section>
<section id="projects" class="row">
<aside class="col-sm-3">
<h3>Projects</h3>
</aside>
<div class="col-sm-9">
<div class="row">
<div class="col-sm-12">
<h4 class="strike-through">
<span>Miss Direction</span>
<span class="date">
Aug 2016 Aug 2016
</span>
</h4>
<div class="website float-right">
<a href="missdirection.example.com">missdirection.example.com</a>
</div>
<div class="roles">
<strong>Team lead, Designer</strong>
<em>at</em>
<strong>Smoogle</strong>
</div>
<div class="description">
<p>A mapping engine that misguides you</p>
</div>
<h4>Highlights</h4>
<ul class="highlights">
<li class="bullet">Won award at AIHacks 2016</li>
<li class="bullet">Built by all women team of newbie programmers</li>
<li class="bullet">Using modern technologies such as GoogleMaps, Chrome Extension and Javascript</li>
</ul>
</div>
</div>
</div>
</section>
<section id="awards" class="row">
<aside class="col-sm-3">
<h3>Awards</h3>
</aside>
<div class="col-sm-9">
<div class="row">
<div class="col-sm-12">
<h4 class="strike-through">
<span>Digital Compression Pioneer Award</span>
</h4>
<div class="date float-right">
<em>Awarded</em>
Nov 2014
</div>
<div class="awarder">
<em>by</em>
<strong>Techcrunch</strong>
</div>
<div class="summary">
There is no spoon.
</div>
</div>
</div>
</div>
</section>
<section id="publications" class="row">
<aside class="col-sm-3">
<h3>Publications</h3>
</aside>
<div class="col-sm-9">
<div class="row">
<div class="col-sm-12">
<h4 class="strike-through">
<span>Video compression for 3d media</span>
<span class="date">
2014-10-01
</span>
</h4>
<div class="website float-right">
<a href="http://en.wikipedia.org/wiki/Silicon_Valley_(TV_series)">http://en.wikipedia.org/wiki/Silicon_Valley_(TV_series)</a>
</div>
<div class="publisher">
<em>Published by</em>
<strong>Hooli</strong>
</div>
<div class="summary">
<p>Innovative middle-out compression algorithm that changes the way we store data.</p>
</div>
</div>
</div>
</div>
</section>
<section id="skills" class="row">
<aside class="col-sm-3">
<h3>Skills</h3>
</aside>
<div class="col-sm-9">
<div class="row">
<div class="col-sm-6">
<div class="name">
<h4>Web Development</h4>
</div>
<ul class="keywords">
<li>HTML</li><li>CSS</li><li>Javascript</li>
</ul>
</div>
<div class="col-sm-6">
<div class="name">
<h4>Compression</h4>
</div>
<ul class="keywords">
<li>Mpeg</li><li>MP4</li><li>GIF</li>
</ul>
</div>
</div>
</div>
</section>
<section id="languages" class="row">
<aside class="col-sm-3">
<h3>Languages</h3>
</aside>
<div class="col-sm-9">
<div class="row">
<div class="col-sm-6">
<div class="language">
<strong>English</strong>
</div>
<div class="fluency">
Native speaker
</div>
</div>
</div>
</div>
</section>
<section id="interests" class="row">
<aside class="col-sm-3">
<h3>Interests</h3>
</aside>
<div class="col-sm-9">
<div class="row">
<div class="col-sm-6">
<div class="name">
<h4>Wildlife</h4>
</div>
<ul class="keywords">
<li>Ferrets</li><li>Unicorns</li>
</ul>
</div>
</div>
</div>
</section>
<section id="references" class="row">
<aside class="col-sm-3">
<h3>References</h3>
</aside>
<div class="col-sm-9">
<div class="row">
<div class="col-sm-12">
<blockquote class="reference">
<p>It is my pleasure to recommend Richard, his performance working as a consultant for Main St. Company proved that he will be a valuable addition to any company.</p>
<p class="name">
<strong> Erlich Bachman</strong>
</p>
</blockquote>
</div>
</div>
</div>
</section>
</div>
</body>
</html>
`

9
test/render.js Normal file
View File

@ -0,0 +1,9 @@
const { test } = require('tap')
const { render } = require('..');
const resume = require('./resume.json')
test('renders a resume', t => {
t.matchSnapshot(render(resume));
t.end();
})

161
test/resume.json Normal file
View File

@ -0,0 +1,161 @@
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"basics": {
"name": "Richard Hendriks",
"label": "Programmer",
"image": "",
"email": "richard.hendriks@mail.com",
"phone": "(912) 555-4321",
"url": "http://richardhendricks.example.com",
"summary": "Richard hails from Tulsa. He has earned degrees from the University of Oklahoma and Stanford. (Go Sooners and Cardinal!) Before starting Pied Piper, he worked for Hooli as a part time software developer. While his work focuses on applied information theory, mostly optimizing lossless compression schema of both the length-limited and adaptive variants, his non-work interests range widely, everything from quantum computing to chaos theory. He could tell you about it, but THAT would NOT be a “length-limited” conversation!",
"location": {
"address": "2712 Broadway St",
"postalCode": "CA 94115",
"city": "San Francisco",
"countryCode": "US",
"region": "California"
},
"profiles": [
{
"network": "Twitter",
"username": "neutralthoughts",
"url": ""
},
{
"network": "SoundCloud",
"username": "dandymusicnl",
"url": "https://soundcloud.example.com/dandymusicnl"
}
]
},
"work": [
{
"name": "Pied Piper",
"location": "Palo Alto, CA",
"description": "Awesome compression company",
"position": "CEO/President",
"url": "http://piedpiper.example.com",
"startDate": "2013-12-01",
"endDate": "2014-12-01",
"summary": "Pied Piper is a multi-platform technology based on a proprietary universal compression algorithm that has consistently fielded high Weisman Scores™ that are not merely competitive, but approach the theoretical limit of lossless compression.",
"highlights": [
"Build an algorithm for artist to detect if their music was violating copy right infringement laws",
"Successfully won Techcrunch Disrupt",
"Optimized an algorithm that holds the current world record for Weisman Scores"
]
}
],
"volunteer": [
{
"organization": "CoderDojo",
"position": "Teacher",
"url": "http://coderdojo.example.com/",
"startDate": "2012-01-01",
"endDate": "2013-01-01",
"summary": "Global movement of free coding clubs for young people.",
"highlights": [
"Awarded 'Teacher of the Month'"
]
}
],
"education": [
{
"institution": "University of Oklahoma",
"url": "https://www.ou.edu/",
"area": "Information Technology",
"studyType": "Bachelor",
"startDate": "2011-06-01",
"endDate": "2014-01-01",
"gpa": "4.0",
"courses": [
"DB1101 - Basic SQL",
"CS2011 - Java Introduction"
]
}
],
"awards": [
{
"title": "Digital Compression Pioneer Award",
"date": "2014-11-01",
"awarder": "Techcrunch",
"summary": "There is no spoon."
}
],
"publications": [
{
"name": "Video compression for 3d media",
"publisher": "Hooli",
"releaseDate": "2014-10-01",
"url": "http://en.wikipedia.org/wiki/Silicon_Valley_(TV_series)",
"summary": "Innovative middle-out compression algorithm that changes the way we store data."
}
],
"skills": [
{
"name": "Web Development",
"level": "Master",
"keywords": [
"HTML",
"CSS",
"Javascript"
]
},
{
"name": "Compression",
"level": "Master",
"keywords": [
"Mpeg",
"MP4",
"GIF"
]
}
],
"languages": [
{
"language": "English",
"fluency": "Native speaker"
}
],
"interests": [
{
"name": "Wildlife",
"keywords": [
"Ferrets",
"Unicorns"
]
}
],
"references": [
{
"name": "Erlich Bachman",
"reference": "It is my pleasure to recommend Richard, his performance working as a consultant for Main St. Company proved that he will be a valuable addition to any company."
}
],
"projects": [
{
"name": "Miss Direction",
"description": "A mapping engine that misguides you",
"highlights": [
"Won award at AIHacks 2016",
"Built by all women team of newbie programmers",
"Using modern technologies such as GoogleMaps, Chrome Extension and Javascript"
],
"keywords": [
"GoogleMaps", "Chrome Extension", "Javascript"
],
"startDate": "2016-08-24",
"endDate": "2016-08-24",
"url": "missdirection.example.com",
"roles": [
"Team lead", "Designer"
],
"entity": "Smoogle",
"type": "application"
}
],
"meta": {
"canonical": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/sample.resume.json",
"version": "v1.0.0",
"lastModified": "2017-12-24T15:53:00"
}
}