mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
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.
30 lines
905 B
JavaScript
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)
|
|
})
|
|
})
|