mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
test(utils): make tests for relativeTo platform agnostic
This commit is contained in:
parent
c017da10f6
commit
919b5395af
@ -1,3 +1,4 @@
|
|||||||
|
import path from 'path'
|
||||||
import { Utils } from '../utils'
|
import { Utils } from '../utils'
|
||||||
|
|
||||||
describe('utils', () => {
|
describe('utils', () => {
|
||||||
@ -218,13 +219,16 @@ describe('utils', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('relativeTo', () => {
|
describe('relativeTo', () => {
|
||||||
|
const path1 = path.join(path.sep, 'foo', 'bar')
|
||||||
|
const path2 = path.join(path.sep, 'foo', 'baz')
|
||||||
|
|
||||||
test('makes path relative to dir', () => {
|
test('makes path relative to dir', () => {
|
||||||
expect(Utils.relativeTo('/foo/bar', '/foo/baz')).toBe('../baz')
|
expect(Utils.relativeTo(path1, path2)).toBe(Utils.wp(`..${path.sep}baz`))
|
||||||
})
|
})
|
||||||
|
|
||||||
test('keeps webpack inline loaders prepended', () => {
|
test('keeps webpack inline loaders prepended', () => {
|
||||||
expect(Utils.relativeTo('/foo/bar', 'loader1!loader2!/foo/baz'))
|
expect(Utils.relativeTo(path1, `loader1!loader2!${path2}`))
|
||||||
.toBe('loader1!loader2!../baz')
|
.toBe(Utils.wp(`loader1!loader2!..${path.sep}baz`))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user