diff --git a/test/uniqueElements/uniqueElements.js b/test/uniqueElements/uniqueElements.js new file mode 100644 index 000000000..3ef175c0b --- /dev/null +++ b/test/uniqueElements/uniqueElements.js @@ -0,0 +1 @@ +module.exports = uniqueElements = arr => [...new Set(arr)]; \ No newline at end of file diff --git a/test/uniqueElements/uniqueElements.test.js b/test/uniqueElements/uniqueElements.test.js new file mode 100644 index 000000000..d2e30f925 --- /dev/null +++ b/test/uniqueElements/uniqueElements.test.js @@ -0,0 +1,14 @@ +const test = require('tape'); +const uniqueElements = require('./uniqueElements.js'); + +test('Testing uniqueElements', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof uniqueElements === 'function', 'uniqueElements is a Function'); + t.deepEqual(uniqueElements([1, 2, 2, 3, 4, 4, 5]), [1,2,3,4,5], "Returns all unique values of an array"); + //t.deepEqual(uniqueElements(args..), 'Expected'); + //t.equal(uniqueElements(args..), 'Expected'); + //t.false(uniqueElements(args..), 'Expected'); + //t.throws(uniqueElements(args..), 'Expected'); + t.end(); +}); \ No newline at end of file