ran npm run tdd & generated TDD
This commit is contained in:
6
test/toSnakeCase/toSnakeCase.js
Normal file
6
test/toSnakeCase/toSnakeCase.js
Normal file
@ -0,0 +1,6 @@
|
||||
module.exports = str =>
|
||||
str &&
|
||||
str
|
||||
.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)
|
||||
.map(x => x.toLowerCase())
|
||||
.join('_');
|
||||
13
test/toSnakeCase/toSnakeCase.test.js
Normal file
13
test/toSnakeCase/toSnakeCase.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const toSnakeCase = require('./toSnakeCase.js');
|
||||
|
||||
test('Testing toSnakeCase', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof toSnakeCase === 'function', 'toSnakeCase is a Function');
|
||||
//t.deepEqual(toSnakeCase(args..), 'Expected');
|
||||
//t.equal(toSnakeCase(args..), 'Expected');
|
||||
//t.false(toSnakeCase(args..), 'Expected');
|
||||
//t.throws(toSnakeCase(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
Reference in New Issue
Block a user