Files
meteor/tests/lib/util/meta/getRelativePath.js
Dominik Ferber bbf9f22109 refactor(): Determine env only once per file
Also fixes a bug in audit-argument-checks where it would show errors in non-meteor blocks.

BREAKING CHANGE: Envs specified through comments are now restricted to client and server.
2015-10-17 23:28:42 +02:00

30 lines
905 B
JavaScript

/* eslint-env mocha */
import assert from 'assert'
const rewire = require('rewire')
const getRelativePath = rewire('../../../../dist/util/meta/getRelativePath.js')
getRelativePath.__set__('getRootPath', function (filename) {
if (filename === '/Users/anon/git/meteor-project/client/file.js') {
return '/Users/anon/git/meteor-project'
}
return false
})
describe('getRelativePath', function () {
it('gets the correct relative path', function () {
const result = getRelativePath('/Users/anon/git/meteor-project/client/file.js')
assert.equal(result, 'client/file.js')
})
it('returns false if no root path is found', function () {
const result = getRelativePath('/Users/anon/git/file.js')
assert.equal(result, false)
})
it('returns false when called with default name', function () {
const result = getRelativePath('<input>')
assert.equal(result, false)
})
})