mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-03-30 15:08:28 +00:00
Expand test with harder tests.
This commit is contained in:
parent
194ecafb0a
commit
ed28fb4136
@ -1,11 +1,13 @@
|
||||
import { equal } from 'assert'
|
||||
import Path from 'path'
|
||||
import { join, posixJoin, win32Join } from '../src/utils/path-join.js'
|
||||
import { posixJoin, win32Join } from '../src/utils/path-join.js'
|
||||
|
||||
const platform = process.platform
|
||||
|
||||
const createTestData = s => [
|
||||
[s],
|
||||
[],
|
||||
[''],
|
||||
[s],
|
||||
[s, 'test'],
|
||||
['test'],
|
||||
['test', s],
|
||||
@ -14,7 +16,11 @@ const createTestData = s => [
|
||||
[`test${s}`, s, `${s}${s}`, `${s}a`],
|
||||
[`test${s}`, '.', `${s}a`],
|
||||
[`test${s}.${s}a`],
|
||||
['test', s, '.', s]
|
||||
['test', s, '.', s],
|
||||
['/test', '\\', 'mixed'],
|
||||
['\\test', '/', 'mixed'],
|
||||
['test', '/', 'mixed', '\\', 'data'],
|
||||
['test', '\\', 'mixed', '/', 'data']
|
||||
]
|
||||
|
||||
const posixTestData = createTestData('/')
|
||||
@ -62,13 +68,13 @@ describe('Path join on win32', () => {
|
||||
|
||||
it('gives the same results as Path using posix paths', () => {
|
||||
for (const data of posixTestData) {
|
||||
equal(Path.win32.join(...data), join(...data))
|
||||
equal(Path.join(...data), join(...data))
|
||||
}
|
||||
})
|
||||
|
||||
it('gives the same results as Path using win32 paths', () => {
|
||||
for (const data of win32TestData) {
|
||||
equal(Path.win32.join(...data), join(...data))
|
||||
equal(Path.join(...data), join(...data))
|
||||
}
|
||||
})
|
||||
})
|
||||
@ -87,13 +93,13 @@ describe('Path join on posix', () => {
|
||||
|
||||
it('gives the same results as Path using posix paths', () => {
|
||||
for (const data of posixTestData) {
|
||||
equal(Path.posix.join(...data), join(...data))
|
||||
equal(Path.join(...data), join(...data))
|
||||
}
|
||||
})
|
||||
|
||||
it('gives the same results as Path using win32 paths', () => {
|
||||
for (const data of win32TestData) {
|
||||
equal(Path.posix.join(...data), join(...data))
|
||||
equal(Path.join(...data), join(...data))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user