mirror of
https://github.com/bower/bower.git
synced 2026-01-13 08:17:58 -05:00
26 lines
904 B
JavaScript
26 lines
904 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')
|
|
);
|
|
});
|
|
});
|