Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
71 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,46 @@ | ||
import test from 'ava'; | ||
import m from './'; | ||
|
||
test(t => { | ||
test('default options', t => { | ||
const name = 'unicorn'; | ||
const paths = m(name); | ||
|
||
console.log(`name: '${name}' opts = undefined`); | ||
|
||
Object.keys(paths).forEach(key => { | ||
const val = paths[key]; | ||
console.log(` ${key}: ${val}`); | ||
t.true(val.endsWith(`${name}-nodejs`)); | ||
}); | ||
|
||
console.log('\n'); | ||
}); | ||
|
||
test('custom suffix', t => { | ||
const name = 'unicorn'; | ||
const opts = {suffix: 'horn'}; | ||
const paths = m(name, opts); | ||
|
||
console.log(`name: '${name}' opts = {suffix: '${opts.suffix}'}`); | ||
|
||
Object.keys(paths).forEach(key => { | ||
const val = paths[key]; | ||
console.log(` ${key}: ${val}`); | ||
t.true(val.endsWith(`${name}-${opts.suffix}`)); | ||
}); | ||
|
||
console.log('\n'); | ||
}); | ||
|
||
test('no suffix', t => { | ||
const name = 'unicorn'; | ||
const paths = m(name, {suffix: ''}); | ||
|
||
console.log(`name: '${name}' opts = {suffix: ''}`); | ||
|
||
Object.keys(paths).forEach(key => { | ||
const val = paths[key]; | ||
console.log(`${key}: ${val}`); | ||
t.true(val.includes(name)); | ||
console.log(` ${key}: ${val}`); | ||
t.true(val.endsWith(`${name}`)); | ||
}); | ||
}); |