Skip to content

Instantly share code, notes, and snippets.

@thibault
Created April 1, 2014 18:15
Show Gist options
  • Save thibault/9919802 to your computer and use it in GitHub Desktop.
Save thibault/9919802 to your computer and use it in GitHub Desktop.
Base js app
// js/app.js
(function(exports) {
"use strict";
var DEFAULT_PRICE = 25;
var CHEAP_LIMIT = 15;
var Hotel = exports.Hotel = function Hotel(name, price) {
this.name = name;
this.price = ((price === undefined) ? DEFAULT_PRICE : price);
};
Hotel.prototype.isCheap = function() {
return this.price <= CHEAP_LIMIT;
};
})(this);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Tests</title>
</head>
<body>
<script src="js/app.js"></script>
</body>
</html>
MOCHA='./node_modules/mocha/bin/mocha'
TEST_DIR='tests'
all: test
test:
$(MOCHA) $(TEST_DIR)
.PHONY: test
// tests/tests.js
var assert = require('chai').assert;
var Hotel = require('../js/app').Hotel;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment