chore(tests): refactor data
This commit is contained in:
parent
aa448e7a41
commit
b140a2ca3e
@ -8,66 +8,54 @@ import { parse, format } from './'
|
|||||||
|
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
|
|
||||||
const FILE_FIXED = {
|
// Data used for both parse and format (i.e. correctly formatted).
|
||||||
url: 'file:///var/lib/xoa/backup',
|
const data = {
|
||||||
type: 'local',
|
|
||||||
path: '/var/lib/xoa/backup'
|
|
||||||
}
|
|
||||||
|
|
||||||
const SMB = {
|
|
||||||
url: 'smb://Administrator:password@toto\\\\192.168.100.225\\smb\0',
|
|
||||||
type: 'smb',
|
|
||||||
host: '192.168.100.225\\smb',
|
|
||||||
path: undefined,
|
|
||||||
domain: 'toto',
|
|
||||||
username: 'Administrator',
|
|
||||||
password: 'password'
|
|
||||||
}
|
|
||||||
|
|
||||||
const SMB_AROBAS = {
|
|
||||||
url: 'smb://Administrator:pass@word@toto\\\\192.168.100.225\\smb\0',
|
|
||||||
type: 'smb',
|
|
||||||
host: '192.168.100.225\\smb',
|
|
||||||
path: undefined,
|
|
||||||
domain: 'toto',
|
|
||||||
username: 'Administrator',
|
|
||||||
password: 'pass@word'
|
|
||||||
}
|
|
||||||
|
|
||||||
const SMB_COLON = {
|
|
||||||
url: 'smb://Administrator:pass:word@toto\\\\192.168.100.225\\smb\0',
|
|
||||||
type: 'smb',
|
|
||||||
host: '192.168.100.225\\smb',
|
|
||||||
path: undefined,
|
|
||||||
domain: 'toto',
|
|
||||||
username: 'Administrator',
|
|
||||||
password: 'pass:word'
|
|
||||||
}
|
|
||||||
|
|
||||||
const parseData = {
|
|
||||||
file: {
|
|
||||||
url: 'file://var/lib/xoa/backup', // Remotes formatted before fixing #7 will not break when reparses
|
|
||||||
type: 'local',
|
|
||||||
path: '/var/lib/xoa/backup'
|
|
||||||
},
|
|
||||||
fileFixed: FILE_FIXED,
|
|
||||||
smb: SMB,
|
|
||||||
'smb@inPassword': SMB_AROBAS,
|
|
||||||
'smb:inPassword': SMB_COLON
|
|
||||||
}
|
|
||||||
|
|
||||||
const formatData = {
|
|
||||||
file: {
|
file: {
|
||||||
url: 'file:///var/lib/xoa/backup',
|
url: 'file:///var/lib/xoa/backup',
|
||||||
type: 'local',
|
type: 'local',
|
||||||
path: '/var/lib/xoa/backup'
|
path: '/var/lib/xoa/backup'
|
||||||
},
|
},
|
||||||
fileFixed: FILE_FIXED,
|
SMB: {
|
||||||
smb: SMB,
|
url: 'smb://Administrator:password@toto\\\\192.168.100.225\\smb\0',
|
||||||
'smb@inPassword': SMB_AROBAS,
|
type: 'smb',
|
||||||
'smb:inPassword': SMB_COLON
|
host: '192.168.100.225\\smb',
|
||||||
|
path: undefined,
|
||||||
|
domain: 'toto',
|
||||||
|
username: 'Administrator',
|
||||||
|
password: 'password'
|
||||||
|
},
|
||||||
|
'SMB with @ sign in password': {
|
||||||
|
url: 'smb://Administrator:pass@word@toto\\\\192.168.100.225\\smb\0',
|
||||||
|
type: 'smb',
|
||||||
|
host: '192.168.100.225\\smb',
|
||||||
|
path: undefined,
|
||||||
|
domain: 'toto',
|
||||||
|
username: 'Administrator',
|
||||||
|
password: 'pass@word'
|
||||||
|
},
|
||||||
|
'SMB with colon in password': {
|
||||||
|
url: 'smb://Administrator:pass:word@toto\\\\192.168.100.225\\smb\0',
|
||||||
|
type: 'smb',
|
||||||
|
host: '192.168.100.225\\smb',
|
||||||
|
path: undefined,
|
||||||
|
domain: 'toto',
|
||||||
|
username: 'Administrator',
|
||||||
|
password: 'pass:word'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const parseData = {
|
||||||
|
...data,
|
||||||
|
|
||||||
|
'file with missing leading slash (#7)': {
|
||||||
|
url: 'file://var/lib/xoa/backup',
|
||||||
|
type: 'local',
|
||||||
|
path: '/var/lib/xoa/backup'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const formatData = data
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
|
||||||
describe('format', () => {
|
describe('format', () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user