From bc40529a73b1f29bf3ab16ff7ad656ea0aea6155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Feje=C5=A1?= Date: Wed, 10 Jan 2018 11:34:15 +0100 Subject: [PATCH] add 2 tests, toOrdinalSuffix, toSafeInteger --- test/toOrdinalSuffix/toOrdinalSuffix.test.js | 5 +++++ test/toSafeInteger/toSafeInteger.test.js | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/test/toOrdinalSuffix/toOrdinalSuffix.test.js b/test/toOrdinalSuffix/toOrdinalSuffix.test.js index bc261a66c..d33dead0a 100644 --- a/test/toOrdinalSuffix/toOrdinalSuffix.test.js +++ b/test/toOrdinalSuffix/toOrdinalSuffix.test.js @@ -5,6 +5,11 @@ test('Testing toOrdinalSuffix', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof toOrdinalSuffix === 'function', 'toOrdinalSuffix is a Function'); + t.equal(toOrdinalSuffix('123'), '123rd', 'Adds an ordinal suffix to a number'); + t.equal(toOrdinalSuffix(5), '5th', 'Adds an ordinal suffix to a number'); + t.equal(toOrdinalSuffix(1), '1st', 'Adds an ordinal suffix to a number'); + t.equal(toOrdinalSuffix(0), '0th', 'Adds an ordinal suffix to a number'); + // t.equal(toOrdinalSuffix(), ,); //t.deepEqual(toOrdinalSuffix(args..), 'Expected'); //t.equal(toOrdinalSuffix(args..), 'Expected'); //t.false(toOrdinalSuffix(args..), 'Expected'); diff --git a/test/toSafeInteger/toSafeInteger.test.js b/test/toSafeInteger/toSafeInteger.test.js index d60c7a9d9..e04013774 100644 --- a/test/toSafeInteger/toSafeInteger.test.js +++ b/test/toSafeInteger/toSafeInteger.test.js @@ -5,6 +5,11 @@ test('Testing toSafeInteger', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof toSafeInteger === 'function', 'toSafeInteger is a Function'); + t.equal(toSafeInteger(3.2), 3, "Converts a value to a safe integer"); + t.equal(toSafeInteger('4.2'), 4, "Converts a value to a safe integer"); + t.equal(toSafeInteger(4.6), 5, "Converts a value to a safe integer"); + t.equal(toSafeInteger(1.5), 2, "Converts a value to a safe integer"); + t.equal(toSafeInteger(Infinity), 9007199254740991, "Converts a value to a safe integer"); //t.deepEqual(toSafeInteger(args..), 'Expected'); //t.equal(toSafeInteger(args..), 'Expected'); //t.false(toSafeInteger(args..), 'Expected');