mirror of
https://github.com/bower/bower.git
synced 2026-01-12 15:58:06 -05:00
19 lines
821 B
JavaScript
19 lines
821 B
JavaScript
var path = require('path');
|
|
var expect = require('expect.js');
|
|
var relativeToBaseDir = require('../../lib/util/relativeToBaseDir');
|
|
|
|
describe('relativeToBaseDir', function () {
|
|
|
|
var joinOrReturnAbsolutePath = relativeToBaseDir('/tmp');
|
|
|
|
it('returns a partial function that joins paths of the partials first arguments', function () {
|
|
expect(joinOrReturnAbsolutePath('foo')).to.be.equal(path.resolve('/tmp/foo'));
|
|
expect(joinOrReturnAbsolutePath('./foo')).to.be.equal(path.resolve('/tmp/foo'));
|
|
});
|
|
|
|
it('returns a partial function that returns it\'s first argument when it begins with /', function () {
|
|
expect(joinOrReturnAbsolutePath('/foo')).to.be.equal(path.resolve('/foo'));
|
|
expect(joinOrReturnAbsolutePath('/foo/bar')).to.be.equal(path.resolve('/foo/bar'));
|
|
});
|
|
});
|