Created
April 1, 2014 18:15
-
-
Save thibault/9919802 to your computer and use it in GitHub Desktop.
Base js app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Tests</title> | |
</head> | |
<body> | |
<script src="js/app.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MOCHA='./node_modules/mocha/bin/mocha' | |
TEST_DIR='tests' | |
all: test | |
test: | |
$(MOCHA) $(TEST_DIR) | |
.PHONY: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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