Skip to content
This repository has been archived by the owner on Jan 13, 2018. It is now read-only.

Commit

Permalink
Rewrite tests from vows to mocha: util tests
Browse files Browse the repository at this point in the history
See #140
  • Loading branch information
arikon committed Jun 5, 2012
1 parent 9330cfb commit 18a044f
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 53 deletions.
53 changes: 0 additions & 53 deletions test/util-test.js

This file was deleted.

66 changes: 66 additions & 0 deletions test/util.mocha.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
var assert = require('chai').assert,
U = require('../lib/util'),
PATH = require('../lib/path');

/**
* Mocha BDD interface.
*
* @name describe @function
* @name it @function
* @name before @function
* @name after @function
* @name beforeEach @function
* @name afterEach @function
*/

describe('util', function() {

describe('getBemTechPath()', function() {

it("'css' resolves to 'bem/lib/techs/css'", function() {
assert.equal(U.getBemTechPath('css'), PATH.unixToOs('bem/lib/techs/css'));
});

it("'custom' resolves to 'bem/lib/tech'", function() {
assert.equal(U.getBemTechPath('custom'), PATH.unixToOs('bem/lib/tech'));
});

});

describe('isRequireable()', function() {

it("'path' returns true", function() {
assert.isTrue(U.isRequireable('path'));
});

it("'unexistent-module' returns false", function() {
assert.isFalse(U.isRequireable('unexistent-module'));
});

});

describe('isPath()', function() {

it("'/path/to/file' returns true", function() {
assert.isTrue(U.isPath(PATH.unixToOs('/path/to/file')));
});

it("'./path/to/file' returns true", function() {
assert.isTrue(U.isPath('.' + PATH.unixToOs('/path/to/file')));
});

it("'path/to/file' returns true", function() {
assert.isTrue(U.isPath(PATH.unixToOs('path/to/file')));
});

it("'file' returns false", function() {
assert.isFalse(U.isPath('file'));
});

it("'file.ext' returns false", function() {
assert.isFalse(U.isPath('file.ext'));
});

});

});

0 comments on commit 18a044f

Please sign in to comment.