Skip to content
This repository has been archived by the owner on May 8, 2021. It is now read-only.

Commit

Permalink
added __version__ property to l33teral; updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholascloud committed Jun 12, 2013
1 parent acad2dd commit a3125f8
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Jakefile.js
Expand Up @@ -11,7 +11,7 @@ var ROOT_DIR = __dirname,
BUILD_DIR = path.join(ROOT_DIR, 'build'),
TEST_DIR = path.join(ROOT_DIR, 'test');

var VERSION_TEMPLATE_VAR = '{{VERSION}}';
var VERSION_TEMPLATE_VAR = /\{\{VERSION\}\}/g;

namespace('package', function () {
// gets the project version from package.json
Expand Down Expand Up @@ -50,7 +50,7 @@ task('build', ['clean', BUILD_DIR], function () {
});

desc('runs unit tests');
task('test', function () {
task('test', ['build'], function () {
console.log('@@ TEST_DIR', TEST_DIR);

var mochaBin = path.join(ROOT_DIR, 'node_modules', '.bin', 'mocha');
Expand Down
3 changes: 2 additions & 1 deletion build/l33teral-0.7.4.js → build/l33teral-0.7.5.js
@@ -1,5 +1,5 @@
/**
* l33teral 0.7.4
* l33teral 0.7.5
*
* The MIT License (MIT)
*
Expand Down Expand Up @@ -67,6 +67,7 @@
* @constructor
*/
function L33teral(obj) {
this.__version__ = '0.7.5';
this.obj = obj || {};
}

Expand Down
1 change: 1 addition & 0 deletions l33teral.js
Expand Up @@ -42,6 +42,7 @@
* @constructor
*/
function L33teral(obj) {
this.__version__ = '{{VERSION}}';
this.obj = obj || {};
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "l33teral",
"version": "0.7.4",
"version": "0.7.5",
"author": "Nicholas Cloud",
"description": "functions to help deal with object literals",
"keywords": ["literals", "objects", "utilities"],
Expand Down
17 changes: 16 additions & 1 deletion test/l33teral.mocha.js
Expand Up @@ -3,11 +3,22 @@
var _ = require('underscore'),
mocha = require('mocha'),
assert = require('chai').assert,
leet = require('../l33teral'),
version = require('../package.json').version,
leet = require('../build/l33teral-' + version),
mockObject = require('./mock-object');

describe('L33teral', function () {

describe('#__version__', function () {
it('should be equal to the package version', function (done) {
var leetMock = leet(null);
var actual = leetMock.__version__;
var expected = version;
assert.equal(actual, expected);
done();
});
});

describe('#obj', function () {
it('should be equal to the constructor argument', function (done) {
var expected = mockObject();
Expand Down Expand Up @@ -80,6 +91,10 @@ describe('L33teral', function () {
actual = leetMock.tap('phoneNumber.1.type');
assert.equal(actual, expected);

expected = 10021;
actual = leetMock.tap('address.postalCode');
assert.equal(actual, expected);

done();
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/mock-object.js
Expand Up @@ -9,7 +9,7 @@ var obj = {
"streetAddress": "21 2nd Street",
"city": "New York",
"state": "NY",
"postalCode": "10021"
"postalCode": 10021
},
"phoneNumber": [
{
Expand Down

0 comments on commit a3125f8

Please sign in to comment.