fix conflicts

This commit is contained in:
Rohit Tanwar
2018-02-12 20:37:21 +05:30
40 changed files with 1936 additions and 5045 deletions

View File

@ -5,9 +5,10 @@ test('Testing JSONToFile', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof JSONToFile === 'function', 'JSONToFile is a Function');
t.pass('Tested on 09/02/2018 by @chalarangelo');
//t.deepEqual(JSONToFile(args..), 'Expected');
//t.equal(JSONToFile(args..), 'Expected');
//t.false(JSONToFile(args..), 'Expected');
//t.throws(JSONToFile(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,10 @@ test('Testing UUIDGeneratorBrowser', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof UUIDGeneratorBrowser === 'function', 'UUIDGeneratorBrowser is a Function');
t.pass('Tested 09/02/2018 by @chalarangelo');
//t.deepEqual(UUIDGeneratorBrowser(args..), 'Expected');
//t.equal(UUIDGeneratorBrowser(args..), 'Expected');
//t.false(UUIDGeneratorBrowser(args..), 'Expected');
//t.throws(UUIDGeneratorBrowser(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,12 @@ test('Testing UUIDGeneratorNode', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof UUIDGeneratorNode === 'function', 'UUIDGeneratorNode is a Function');
const uuid = UUIDGeneratorNode();
t.deepEqual([uuid[8], uuid[13], uuid[18], uuid[23]], ['-', '-', '-', '-'], 'Contains dashes in the proper places');
t.true(/^[0-9A-Fa-f-]+$/.test(uuid), 'Only contains hexadecimal digits');
//t.deepEqual(UUIDGeneratorNode(args..), 'Expected');
//t.equal(UUIDGeneratorNode(args..), 'Expected');
//t.false(UUIDGeneratorNode(args..), 'Expected');
//t.throws(UUIDGeneratorNode(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,10 @@ test('Testing bottomVisible', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof bottomVisible === 'function', 'bottomVisible is a Function');
t.pass('Tested on 09/02/2018 by @chalarangelo');
//t.deepEqual(bottomVisible(args..), 'Expected');
//t.equal(bottomVisible(args..), 'Expected');
//t.false(bottomVisible(args..), 'Expected');
//t.throws(bottomVisible(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,10 @@ test('Testing colorize', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof colorize === 'function', 'colorize is a Function');
t.pass('Tested on 09/02/2018 by @chalarangelo');
//t.deepEqual(colorize(args..), 'Expected');
//t.equal(colorize(args..), 'Expected');
//t.false(colorize(args..), 'Expected');
//t.throws(colorize(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,10 @@ test('Testing copyToClipboard', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof copyToClipboard === 'function', 'copyToClipboard is a Function');
t.pass('Tested on 09/02/2018 by @chalarangelo');
//t.deepEqual(copyToClipboard(args..), 'Expected');
//t.equal(copyToClipboard(args..), 'Expected');
//t.false(copyToClipboard(args..), 'Expected');
//t.throws(copyToClipboard(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,10 @@ test('Testing detectDeviceType', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof detectDeviceType === 'function', 'detectDeviceType is a Function');
t.pass('Tested on 09/02/2018 by @chalarangelo');
//t.deepEqual(detectDeviceType(args..), 'Expected');
//t.equal(detectDeviceType(args..), 'Expected');
//t.false(detectDeviceType(args..), 'Expected');
//t.throws(detectDeviceType(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,10 @@ test('Testing elementIsVisibleInViewport', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof elementIsVisibleInViewport === 'function', 'elementIsVisibleInViewport is a Function');
t.pass('Tested on 09/02/2018 by @chalarangelo');
//t.deepEqual(elementIsVisibleInViewport(args..), 'Expected');
//t.equal(elementIsVisibleInViewport(args..), 'Expected');
//t.false(elementIsVisibleInViewport(args..), 'Expected');
//t.throws(elementIsVisibleInViewport(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,10 @@ test('Testing httpsRedirect', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof httpsRedirect === 'function', 'httpsRedirect is a Function');
t.pass('Tested on 09/02/2018 by @chalarangelo');
//t.deepEqual(httpsRedirect(args..), 'Expected');
//t.equal(httpsRedirect(args..), 'Expected');
//t.false(httpsRedirect(args..), 'Expected');
//t.throws(httpsRedirect(args..), 'Expected');
t.end();
});
});

View File

@ -5,11 +5,12 @@ test('Testing mapObject', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof mapObject === 'function', 'mapObject is a Function');
const squareIt = arr => mapObject(arr, a => a * a);
t.deepEqual(squareIt([1, 2, 3]), { 1: 1, 2: 4, 3: 9 }, "Maps the values of an array to an object using a function");
//t.deepEqual(mapObject(args..), 'Expected');
t.deepEqual(mapObject([1, 2, 3], a => a * a), { 1: 1, 2: 4, 3: 9 }, "mapObject([1, 2, 3], a => a * a) returns { 1: 1, 2: 4, 3: 9 }");
t.deepEqual(mapObject([1, 2, 3, 4], (a, b) => b - a), { 1: -1, 2: -1, 3: -1, 4: -1 }, 'mapObject([1, 2, 3, 4], (a, b) => b - a) returns { 1: -1, 2: -1, 3: -1, 4: -1 }');
t.deepEqual(mapObject([1, 2, 3, 4], (a, b) => a - b), { 1: 1, 2: 1, 3: 1, 4: 1 }, 'mapObject([1, 2, 3, 4], (a, b) => a - b) returns { 1: 1, 2: 1, 3: 1, 4: 1 }');
//t.equal(mapObject(args..), 'Expected');
//t.false(mapObject(args..), 'Expected');
//t.throws(mapObject(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,10 @@ test('Testing observeMutations', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof observeMutations === 'function', 'observeMutations is a Function');
t.pass('Tested on 09/02/2018 by @chalarangelo');
//t.deepEqual(observeMutations(args..), 'Expected');
//t.equal(observeMutations(args..), 'Expected');
//t.false(observeMutations(args..), 'Expected');
//t.throws(observeMutations(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,13 @@ test('Testing promisify', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof promisify === 'function', 'promisify is a Function');
const x = promisify(Math.max);
t.true(x() instanceof Promise, 'Returns a promise');
const delay = promisify((d, cb) => setTimeout(cb, d));
delay(200).then(() => t.pass('Runs the function provided'));
//t.deepEqual(promisify(args..), 'Expected');
//t.equal(promisify(args..), 'Expected');
//t.false(promisify(args..), 'Expected');
//t.throws(promisify(args..), 'Expected');
t.end();
});
});

View File

@ -7,13 +7,13 @@ test('Testing randomIntArrayInRange', (t) => {
t.true(typeof randomIntArrayInRange === 'function', 'randomIntArrayInRange is a Function');
const lowerLimit = Math.floor(Math.random() * 20);
const upperLimit = Math.floor(lowerLimit + Math.random() * 10);
const randLength = Math.floor(Math.random() * 10)
t.true(randomIntArrayInRange(lowerLimit,upperLimit).length === 1,'The default value of returned array is 1');
t.true(randomIntArrayInRange(lowerLimit,upperLimit,randLength).length === randLength,'The length of returned array is the same as the provided value.')
t.true(randomIntArrayInRange(lowerLimit,upperLimit,randLength).filter(el => !((el>=lowerLimit) && (el <= upperLimit))).length === 0,'The returned values is in range.')
const arr = randomIntArrayInRange(lowerLimit,upperLimit, 10);
t.true(arr.every(x => typeof x === 'number'), 'The returned array contains only integers');
t.equal(arr.length, 10, 'The returned array has the proper length');
t.true(arr.every(x => (x >= lowerLimit) && (x <= upperLimit)),'The returned array\'s values lie between provided lowerLimit and upperLimit (both inclusive).');
//t.deepEqual(randomIntArrayInRange(args..), 'Expected');
//t.equal(randomIntArrayInRange(args..), 'Expected');
//t.false(randomIntArrayInRange(args..), 'Expected');
//t.throws(randomIntArrayInRange(args..), 'Expected');
t.end();
});
});

View File

@ -7,9 +7,9 @@ test('Testing randomIntegerInRange', (t) => {
t.true(typeof randomIntegerInRange === 'function', 'randomIntegerInRange is a Function');
const lowerLimit = Math.floor(Math.random() * 20);
const upperLimit = Math.floor(lowerLimit + Math.random() * 10);
t.true(Number.isInteger(randomIntegerInRange(lowerLimit,upperLimit)),'The returned value is a Integer');
t.true(Number.isInteger(randomIntegerInRange(lowerLimit,upperLimit)),'The returned value is an integer');
const numberForTest = randomIntegerInRange(lowerLimit,upperLimit);
t.true((numberForTest >= lowerLimit) && (numberForTest <= upperLimit),'The returned value lies between provied lowerLimit and upperLimit (both inclusive).');
t.true((numberForTest >= lowerLimit) && (numberForTest <= upperLimit),'The returned value lies between provided lowerLimit and upperLimit (both inclusive).');
//t.deepEqual(randomIntegerInRange(args..), 'Expected');
//t.equal(randomIntegerInRange(args..), 'Expected');
//t.false(randomIntegerInRange(args..), 'Expected');

View File

@ -7,11 +7,12 @@ test('Testing randomNumberInRange', (t) => {
t.true(typeof randomNumberInRange === 'function', 'randomNumberInRange is a Function');
const lowerLimit = Math.floor(Math.random() * 20);
const upperLimit = Math.floor(lowerLimit + Math.random() * 10);
t.true(typeof randomNumberInRange(lowerLimit,upperLimit) === 'number','The returned value is a number');
const numberForTest = randomNumberInRange(lowerLimit,upperLimit);
t.true((numberForTest >= lowerLimit) && (numberForTest <= upperLimit),'The returned value lies between provied lowerLimit and upperLimit (both inclusive).');
t.true((numberForTest >= lowerLimit) && (numberForTest <= upperLimit),'The returned value lies between provided lowerLimit and upperLimit (both inclusive).');
//t.deepEqual(randomNumberInRange(args..), 'Expected');
//t.equal(randomNumberInRange(args..), 'Expected');
//t.false(randomNumberInRange(args..), 'Expected');
//t.throws(randomNumberInRange(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,10 @@ test('Testing readFileLines', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof readFileLines === 'function', 'readFileLines is a Function');
t.pass('Tested on 09/02/2018 by @chalarangelo');
//t.deepEqual(readFileLines(args..), 'Expected');
//t.equal(readFileLines(args..), 'Expected');
//t.false(readFileLines(args..), 'Expected');
//t.throws(readFileLines(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,10 @@ test('Testing redirect', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof redirect === 'function', 'redirect is a Function');
t.pass('Tested on 09/02/2018 by @chalarangelo');
//t.deepEqual(redirect(args..), 'Expected');
//t.equal(redirect(args..), 'Expected');
//t.false(redirect(args..), 'Expected');
//t.throws(redirect(args..), 'Expected');
t.end();
});
});

View File

@ -1,7 +1,6 @@
const runAsync = fn => {
const blob = `var fn = ${fn.toString()}; postMessage(fn());`;
const worker = new Worker(
URL.createObjectURL(new Blob([blob]), {
URL.createObjectURL(new Blob([`postMessage((${fn})());`]), {
type: 'application/javascript; charset=utf-8'
})
);

View File

@ -5,9 +5,10 @@ test('Testing runAsync', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof runAsync === 'function', 'runAsync is a Function');
t.pass('Tested on 09/02/2018 by @chalarangelo');
//t.deepEqual(runAsync(args..), 'Expected');
//t.equal(runAsync(args..), 'Expected');
//t.false(runAsync(args..), 'Expected');
//t.throws(runAsync(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,11 @@ test('Testing runPromisesInSeries', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof runPromisesInSeries === 'function', 'runPromisesInSeries is a Function');
const delay = d => new Promise(r => setTimeout(r, d));
runPromisesInSeries([() => delay(100), () => delay(200).then(() => t.pass('Runs promises in series'))]);
//t.deepEqual(runPromisesInSeries(args..), 'Expected');
//t.equal(runPromisesInSeries(args..), 'Expected');
//t.false(runPromisesInSeries(args..), 'Expected');
//t.throws(runPromisesInSeries(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,13 @@ test('Testing sample', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof sample === 'function', 'sample is a Function');
const arr = [3,7,9,11];
t.true(arr.includes(sample(arr)), 'Returns a random element from the array');
t.equal(sample([1]), 1, 'Works for single-element arrays');
t.equal(sample([]), undefined, 'Returns undefined for empty array');
//t.deepEqual(sample(args..), 'Expected');
//t.equal(sample(args..), 'Expected');
//t.false(sample(args..), 'Expected');
//t.throws(sample(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,15 @@ test('Testing sampleSize', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof sampleSize === 'function', 'sampleSize is a Function');
const arr = [3,7,9,11];
t.equal(sampleSize(arr).length, 1, 'Returns a single element without n specified');
t.true(sampleSize(arr, 2).every(x => arr.includes(x)), 'Returns a random sample of specified size from an array');
t.equal(sampleSize(arr, 5).length, 4, 'Returns all elements in an array if n >= length');
t.deepEqual(sampleSize([], 2), [], 'Returns an empty array if original array is empty');
t.deepEqual(sampleSize(arr, 0), [], 'Returns an empty array if n = 0');
//t.deepEqual(sampleSize(args..), 'Expected');
//t.equal(sampleSize(args..), 'Expected');
//t.false(sampleSize(args..), 'Expected');
//t.throws(sampleSize(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,10 @@ test('Testing scrollToTop', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof scrollToTop === 'function', 'scrollToTop is a Function');
t.pass('Tested on 09/02/2018 by @chalarangelo');
//t.deepEqual(scrollToTop(args..), 'Expected');
//t.equal(scrollToTop(args..), 'Expected');
//t.false(scrollToTop(args..), 'Expected');
//t.throws(scrollToTop(args..), 'Expected');
t.end();
});
});

View File

@ -6,7 +6,10 @@ test('Testing shuffle', (t) => {
//Please go to https://github.com/substack/tape
t.true(typeof shuffle === 'function', 'shuffle is a Function');
const arr = [1,2,3,4,5,6];
//t.notDeepEqual(shuffle(arr), arr, 'Shuffles the array'); Does not work always (got a test failing once)
t.notEqual(shuffle(arr), arr, 'Shuffles the array');
t.true(shuffle(arr).every(x => arr.includes(x)), 'New array contains all original elements');
t.deepEqual(shuffle([]),[],'Works for empty arrays');
t.deepEqual(shuffle([1]),[1],'Works for single-element arrays');
//t.deepEqual(shuffle(args..), 'Expected');
//t.equal(shuffle(args..), 'Expected');
//t.false(shuffle(args..), 'Expected');

File diff suppressed because it is too large Load Diff

View File

@ -5,9 +5,14 @@ test('Testing tomorrow', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof tomorrow === 'function', 'tomorrow is a Function');
const t1 = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() + 1);
const t2 = new Date(tomorrow());
t.equal(t1.getFullYear(), t2.getFullYear(), 'Returns the correct year');
t.equal(t1.getMonth(), t2.getMonth(), 'Returns the correct month');
t.equal(t1.getDate(), t2.getDate(), 'Returns the correct date');
//t.deepEqual(tomorrow(args..), 'Expected');
//t.equal(tomorrow(args..), 'Expected');
//t.false(tomorrow(args..), 'Expected');
//t.throws(tomorrow(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,12 @@ test('Testing untildify', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof untildify === 'function', 'untildify is a Function');
t.true(untildify('~/test/dir/file.f').indexOf('~') === -1, 'Contains no tildes');
t.equal(untildify('~/test/dir/file.f').slice(-16), '/test/dir/file.f', 'Does not alter the rest of the path');
t.equal(untildify('test/dir/file.f'), 'test/dir/file.f', 'Does not alter paths without tildes');
//t.deepEqual(untildify(args..), 'Expected');
//t.equal(untildify(args..), 'Expected');
//t.false(untildify(args..), 'Expected');
//t.throws(untildify(args..), 'Expected');
t.end();
});
});