From fdcc7690758d8f284e631e88ec696d0437032009 Mon Sep 17 00:00:00 2001 From: JCGuerrero Date: Sat, 4 Oct 2025 17:24:41 -0500 Subject: [PATCH 1/8] b --- __tests__/Date/wtf.unit.spec.js | 277 +++++++++++++++++++------------- 1 file changed, 161 insertions(+), 116 deletions(-) diff --git a/__tests__/Date/wtf.unit.spec.js b/__tests__/Date/wtf.unit.spec.js index 0d7625b..ae542e3 100644 --- a/__tests__/Date/wtf.unit.spec.js +++ b/__tests__/Date/wtf.unit.spec.js @@ -2,17 +2,18 @@ describe('Date', () => { 'use strict' - let oDate, dateString, dateValue, milliseconds + let oDate, dateISOString, dateTimeString, dateValue, milliseconds // 1 of 28 describe('new Date("0")', () => { beforeEach(() => { oDate = new Date('0') - dateString = oDate.toISOString() + dateISOString = oDate.toISOString() + dateTimeString = oDate.toTimeString() }) it('does NOT equal "1970-01-01T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('1970-01-01T00:00:00.000Z') + expect(dateISOString).not.toEqual('1970-01-01T00:00:00.000Z') }) it('interprets "0" as the year 2000, not as a timestamp! parsing it as "2000-01-01T06:00:00.000"', () => { @@ -27,17 +28,17 @@ describe('Date', () => { describe('new Date(0)', () => { beforeEach(() => { oDate = new Date(0) - dateString = oDate.toISOString() + dateISOString = oDate.toISOString() }) it('does NOT equal "2000-01-01T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2000-01-01T00:00:00.000Z') + expect(dateISOString).not.toEqual('2000-01-01T00:00:00.000Z') }) it('is interpreted as 0 milliseconds since the Unix epoch (Jan 1, 1970).', () => { // The number 0, as opposed to the string "0", // is interpreted as milliseconds since the Unix epoch (Jan 1, 1970). - expect(dateString).toEqual('1970-01-01T00:00:00.000Z') + expect(dateISOString).toEqual('1970-01-01T00:00:00.000Z') }) }) @@ -116,20 +117,20 @@ describe('Date', () => { // 7 of 28 describe('.toTimeString()', () => { beforeEach(() => { - dateString = oDate.toTimeString() + dateTimeString = oDate.toTimeString() }) it('does NOT equal ""', () => { - expect(dateString).not.toEqual('') + expect(dateTimeString).not.toEqual('') }) it('is NOT null', () => { - expect(dateString).not.toBe(null) + expect(dateTimeString).not.toBe(null) }) it('returns the string "Invalid Date" for invalid dates. 🫠', () => { // toTimeString() returns the string "Invalid Date" for invalid dates. 🫠 - expect(dateString).toEqual('Invalid Date') + expect(dateTimeString).toEqual('Invalid Date') }) }) }) @@ -138,15 +139,15 @@ describe('Date', () => { describe('new Date("1")', () => { beforeEach(() => { oDate = new Date('1') - dateString = oDate.toISOString() + dateISOString = oDate.toISOString() }) it('does NOT equal "1970-01-01T00:00:00.001Z"', () => { - expect(dateString).not.toEqual('1970-01-01T00:00:00.001Z') + expect(dateISOString).not.toEqual('1970-01-01T00:00:00.001Z') }) it('does NOT equal "0001-01-01T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('0001-01-01T00:00:00.000Z') + expect(dateISOString).not.toEqual('0001-01-01T00:00:00.000Z') }) it('equals to "2001-01-01T00:00:00.000"', () => { @@ -162,15 +163,15 @@ describe('Date', () => { describe('new Date("2")', () => { beforeEach(() => { oDate = new Date('2') - dateString = oDate.toISOString() + dateISOString = oDate.toISOString() }) it('does NOT equal "2002-01-01T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2002-01-01T00:00:00.000Z') + expect(dateISOString).not.toEqual('2002-01-01T00:00:00.000Z') }) it('does NOT equal "2001-01-02T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2001-01-02T00:00:00.000Z') + expect(dateISOString).not.toEqual('2001-01-02T00:00:00.000Z') }) it('equals "2001-02-01T00:00:00.000"', () => { @@ -184,15 +185,15 @@ describe('Date', () => { describe('new Date("12")', () => { beforeEach(() => { oDate = new Date('12') - dateString = oDate.toISOString() + dateISOString = oDate.toISOString() }) it('does NOT equal "2012-01-01T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2012-01-01T00:00:00.000Z') + expect(dateISOString).not.toEqual('2012-01-01T00:00:00.000Z') }) it('does NOT equal "2001-01-12T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2001-01-12T00:00:00.000Z') + expect(dateISOString).not.toEqual('2001-01-12T00:00:00.000Z') }) it('equals "2001-12-01T00:00:00.000"', () => { @@ -207,7 +208,7 @@ describe('Date', () => { describe('new Date("13")', () => { beforeEach(() => { oDate = new Date('13') - dateString = oDate.toTimeString() + dateTimeString = oDate.toTimeString() }) describe('.toISOString()', () => { @@ -219,7 +220,7 @@ describe('Date', () => { describe('.toTimeString()', () => { it('equals "Invalid Date"', () => { // "13" would be month 13, which doesn't exist, so it's Invalid Date. - expect(dateString).toEqual('Invalid Date') + expect(dateTimeString).toEqual('Invalid Date') }) }) }) @@ -255,23 +256,29 @@ describe('Date', () => { describe('new Date("12.1")', () => { beforeEach(() => { oDate = new Date('12.1') - dateString = oDate.toISOString() }) - it('does NOT equal "2001-01-01T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2001-01-01T00:00:00.000Z') - }) + describe('.toISOString()', () => { + beforeEach(() => { + // NOTE: FireFox throws here: "Invalid Date". + dateISOString = oDate.toISOString() + }) - it('does NOT equal "2012-01-01T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2012-01-01T00:00:00.000Z') - }) + it('does NOT equal "2001-01-01T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2001-01-01T00:00:00.000Z') + }) - it('equals "2001-12-01T00:00:00.000"', () => { - // "12.1" is interpreted as the date December 1st, - // and as before for dates with no year the default is 2001 because of course. - // expect(dateString).toEqual('2001-12-01T00:00:00.000Z') - const expectedDate = new Date('2001-12-01T00:00:00.000') - expect(oDate.getTime()).toEqual(expectedDate.getTime()) + it('does NOT equal "2012-01-01T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2012-01-01T00:00:00.000Z') + }) + + it('equals "2001-12-01T00:00:00.000"', () => { + // "12.1" is interpreted as the date December 1st, + // and as before for dates with no year the default is 2001 because of course. + // expect(dateString).toEqual('2001-12-01T00:00:00.000Z') + const expectedDate = new Date('2001-12-01T00:00:00.000') + expect(oDate.getTime()).toEqual(expectedDate.getTime()) + }) }) }) @@ -279,12 +286,12 @@ describe('Date', () => { describe('new Date("12.0")', () => { beforeEach(() => { oDate = new Date('12.0') - dateString = oDate.toTimeString() + dateTimeString = oDate.toTimeString() }) describe('.toTimeString()', () => { it('equals "Invalid Date"', () => { - expect(dateString).toEqual('Invalid Date') + expect(dateTimeString).toEqual('Invalid Date') }) }) @@ -299,22 +306,28 @@ describe('Date', () => { describe('new Date("12.-1")', () => { beforeEach(() => { oDate = new Date('12.-1') - dateString = oDate.toISOString() }) - it('does NOT equal "2012-01-01T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2012-01-01T00:00:00.000Z') - }) + describe('.toISOString()', () => { + beforeEach(() => { + // NOTE: FireFox throws here "Invalid Date". + dateISOString = oDate.toISOString() + }) - it('does NOT equal "2001-01-01T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2001-01-01T00:00:00.000Z') - }) + it('does NOT equal "2012-01-01T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2012-01-01T00:00:00.000Z') + }) - it('ignores the "-", interpreting it like "12.1", resulting in "2001-12-01T00:00:00.000"', () => { - // The dash here is ignored, so this is interpreted the same as "12.1". - // expect(dateString).toEqual('2001-12-01T00:00:00.000Z') - const expectedDate = new Date('2001-12-01T00:00:00.000') - expect(oDate.getTime()).toEqual(expectedDate.getTime()) + it('does NOT equal "2001-01-01T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2001-01-01T00:00:00.000Z') + }) + + it('ignores the "-", interpreting it like "12.1", resulting in "2001-12-01T00:00:00.000"', () => { + // The dash here is ignored, so this is interpreted the same as "12.1". + // expect(dateString).toEqual('2001-12-01T00:00:00.000Z') + const expectedDate = new Date('2001-12-01T00:00:00.000') + expect(oDate.getTime()).toEqual(expectedDate.getTime()) + }) }) }) @@ -322,11 +335,11 @@ describe('Date', () => { describe('new Date("perhaps 1")', () => { beforeEach(() => { oDate = new Date('perhaps 1') - dateString = oDate.toISOString() + dateISOString = oDate.toISOString() }) it('does NOT equal "1970-01-01T00:00:01.000Z"', () => { - expect(dateString).not.toEqual('1970-01-01T00:00:01.000Z') + expect(dateISOString).not.toEqual('1970-01-01T00:00:01.000Z') }) it('ignores leading text. Finding "1" and parsing it as January. Resulting in "2001-01-01T00:00:00.000"', () => { @@ -345,12 +358,12 @@ describe('Date', () => { // It needs a number to parse, so this is Invalid Date. // It's equivalent to new Date(""). oDate = new Date('perhaps') - dateString = oDate.toTimeString() + dateTimeString = oDate.toTimeString() }) describe('.toTimeString()', () => { it('equals "Invalid Date"', () => { - expect(dateString).toEqual('Invalid Date') + expect(dateTimeString).toEqual('Invalid Date') }) }) @@ -368,22 +381,28 @@ describe('Date', () => { // And for some reason this expression cares about your local timezone, // which happens to be BST for me right now. oDate = new Date('maybe 1') - dateString = oDate.toISOString() }) - // WARNING: The quiz says this is the correct answer! - it('does NOT equal "2001-04-30T23:00:00.000Z"', () => { - expect(dateString).not.toEqual('2001-04-30T23:00:00.000Z') - }) + describe('.toISOString()', () => { + beforeEach(() => { + // NOTE: FireFox throws here: "Invalid Date". + dateISOString = oDate.toISOString() + }) - it('does NOT equal "2001-01-01T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2001-01-01T00:00:00.000Z') - }) + // WARNING: The quiz says this is the correct answer! + it('does NOT equal "2001-04-30T23:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2001-04-30T23:00:00.000Z') + }) - it('parses "maybe" as "may"! resulting in "2001-05-01T00:00:00.000"', () => { - // expect(dateString).toEqual('2001-05-01T00:00:00.000Z') - const expectedDate = new Date('2001-05-01T00:00:00.000') - expect(oDate.getTime()).toEqual(expectedDate.getTime()) + it('does NOT equal "2001-01-01T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2001-01-01T00:00:00.000Z') + }) + + it('parses "maybe" as "may"! resulting in "2001-05-01T00:00:00.000"', () => { + // expect(dateString).toEqual('2001-05-01T00:00:00.000Z') + const expectedDate = new Date('2001-05-01T00:00:00.000') + expect(oDate.getTime()).toEqual(expectedDate.getTime()) + }) }) }) @@ -394,22 +413,28 @@ describe('Date', () => { // this is just parsing "may 2010" // and again local timezone is important. oDate = new Date('fourth of may 2010') - dateString = oDate.toISOString() }) - // Works only in non-UTC timezones. - xit('does NOT equal "2010-05-01T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2010-05-01T00:00:00.000Z') - }) + describe('.toISOString()', () => { + beforeEach(() => { + // NOTE: FireFox throws here: "Invalid Date". + dateISOString = oDate.toISOString() + }) - it('does NOT equal "2010-05-04T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2010-05-04T00:00:00.000Z') - }) + it('does NOT equal "2010-05-01T00:00:00.000"', () => { + const expectedDate = new Date('2010-05-01T00:00:00.000') + expect(oDate.getTime()).not.toEqual(expectedDate.getTime()) + }) - it('ignores "fourth of", parsing "may 2010" as "2010-05-01T00:00:00.000"', () => { - // expect(dateString).toEqual('2010-05-01T00:00:00.000Z') - const expectedDate = new Date('2010-05-01T00:00:00.000') - expect(oDate.getTime()).toEqual(expectedDate.getTime()) + it('does NOT equal "2010-05-04T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2010-05-04T00:00:00.000Z') + }) + + it('ignores "fourth of", parsing "may 2010" as "2010-05-01T00:00:00.000"', () => { + // expect(dateString).toEqual('2010-05-01T00:00:00.000Z') + const expectedDate = new Date('2010-05-01T00:00:00.000') + expect(oDate.getTime()).toEqual(expectedDate.getTime()) + }) }) }) @@ -418,19 +443,26 @@ describe('Date', () => { beforeEach(() => { // UTC is correctly parsed as a timezone. oDate = new Date('May 4 UTC') - dateString = oDate.toISOString() + dateISOString = oDate.toISOString() }) - it('does NOT equal "2010-04-30T23:00:00.000Z"', () => { - expect(dateString).not.toEqual('2010-04-30T23:00:00.000Z') - }) + describe('.toISOString()', () => { + beforeEach(() => { + // NOTE: FireFox throws here: "Invalid Date". + dateISOString = oDate.toISOString() + }) - it('does NOT equal "2010-05-01T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2010-05-01T00:00:00.000Z') - }) + it('does NOT equal "2010-04-30T23:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2010-04-30T23:00:00.000Z') + }) + + it('does NOT equal "2010-05-01T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2010-05-01T00:00:00.000Z') + }) - it('parses UTC as "2001-05-04T00:00:00.000Z"', () => { - expect(dateString).toEqual('2001-05-04T00:00:00.000Z') + it('parses UTC as "2001-05-04T00:00:00.000Z"', () => { + expect(dateISOString).toEqual('2001-05-04T00:00:00.000Z') + }) }) }) @@ -439,20 +471,27 @@ describe('Date', () => { beforeEach(() => { // You can add modifiers to timezones and it works as you would expect. oDate = new Date('May 4 UTC+1') - dateString = oDate.toISOString() + dateISOString = oDate.toISOString() }) - it('does NOT equal "2001-05-04T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2001-05-04T00:00:00.000Z') - }) + describe('.toISOString()', () => { + beforeEach(() => { + // NOTE: FireFox throws here: "Invalid Date". + dateISOString = oDate.toISOString() + }) - it('does NOT equal "2010-05-01T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2010-05-01T00:00:00.000Z') - }) + it('does NOT equal "2001-05-04T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2001-05-04T00:00:00.000Z') + }) + + it('does NOT equal "2010-05-01T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2010-05-01T00:00:00.000Z') + }) - it('parses UTC+1 as "2001-05-04T00:00:00.000", resulting in "2001-05-03T23:00:00.000Z"', () => { - // 05-04T00 @ UTC+1 is 1 hr ahead: 05-03T23 @ UTC - expect(dateString).toEqual('2001-05-03T23:00:00.000Z') + it('parses UTC+1 as "2001-05-04T00:00:00.000", resulting in "2001-05-03T23:00:00.000Z"', () => { + // 05-04T00 @ UTC+1 is 1 hr ahead: 05-03T23 @ UTC + expect(dateISOString).toEqual('2001-05-03T23:00:00.000Z') + }) }) }) @@ -461,15 +500,21 @@ describe('Date', () => { beforeEach(() => { // It also supports minutes! oDate = new Date('May 4 UTC+1:59') - dateString = oDate.toISOString() }) - it('does NOT equal "2001-05-04T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2001-05-04T00:00:00.000Z') - }) + describe('.toISOString()', () => { + beforeEach(() => { + // NOTE: FireFox throws here: "Invalid Date". + dateISOString = oDate.toISOString() + }) + + it('does NOT equal "2001-05-04T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2001-05-04T00:00:00.000Z') + }) - it('parses UTC+1:59 as "2001-05-04T00:00:00.000", resulting in "2001-05-03T22:01:00.000Z"', () => { - expect(dateString).toEqual('2001-05-03T22:01:00.000Z') + it('parses UTC+1:59 as "2001-05-04T00:00:00.000", resulting in "2001-05-03T22:01:00.000Z"', () => { + expect(dateISOString).toEqual('2001-05-03T22:01:00.000Z') + }) }) }) @@ -480,19 +525,19 @@ describe('Date', () => { // 60 is being parsed as the year here, // UTC+1 is the timezone. oDate = new Date('May 4 UTC+1:60') - dateString = oDate.toISOString() + dateISOString = oDate.toISOString() }) it('does NOT equal "2001-05-04T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2001-05-04T00:00:00.000Z') + expect(dateISOString).not.toEqual('2001-05-04T00:00:00.000Z') }) it('does NOT equal "2001-05-03T22:00:00.000Z"', () => { - expect(dateString).not.toEqual('2001-05-03T22:00:00.000Z') + expect(dateISOString).not.toEqual('2001-05-03T22:00:00.000Z') }) it('parses UTC+1:60 as "UTC+1" AND "year 60"!, resulting in "1960-05-03T23:00:00.000Z"', () => { - expect(dateString).toEqual('1960-05-03T23:00:00.000Z') + expect(dateISOString).toEqual('1960-05-03T23:00:00.000Z') }) }) @@ -501,12 +546,12 @@ describe('Date', () => { beforeEach(() => { // No tricks here, just a plain ol' Invalid Date. oDate = new Date('1990 2010') - dateString = oDate.toTimeString() + dateTimeString = oDate.toTimeString() }) describe('.toTimeString()', () => { it('equals "Invalid Date"', () => { - expect(dateString).toEqual('Invalid Date') + expect(dateTimeString).toEqual('Invalid Date') }) }) @@ -522,15 +567,15 @@ describe('Date', () => { beforeEach(() => { // For some reason, parenthesised text is ignored. oDate = new Date('1990 (2010)') - dateString = oDate.toISOString() + dateISOString = oDate.toISOString() }) it('does NOT equal "2000-01-01T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2000-01-01T00:00:00.000Z') + expect(dateISOString).not.toEqual('2000-01-01T00:00:00.000Z') }) it('does NOT equal "2010-01-01T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2010-01-01T00:00:00.000Z') + expect(dateISOString).not.toEqual('2010-01-01T00:00:00.000Z') }) it('ignores text in parentheses, parsing this as "1990", resulting in "1990-01-01T00:00:00.000"', () => { @@ -545,15 +590,15 @@ describe('Date', () => { beforeEach(() => { // No matter where it is. oDate = new Date('(1990) 2010') - dateString = oDate.toISOString() + dateISOString = oDate.toISOString() }) it('does NOT equal "1990-01-01T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('1990-01-01T00:00:00.000Z') + expect(dateISOString).not.toEqual('1990-01-01T00:00:00.000Z') }) it('does NOT equal "2000-01-01T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2000-01-01T00:00:00.000Z') + expect(dateISOString).not.toEqual('2000-01-01T00:00:00.000Z') }) it('ignores text in parentheses, parsing this as "2010", resulting in "2010-01-01T00:00:00.000"', () => { @@ -569,15 +614,15 @@ describe('Date', () => { // -[] is coerced to 0, // which is interpreted as milliseconds since the Unix epoch (Jan 1, 1970). oDate = new Date(-[]) - dateString = oDate.toISOString() + dateISOString = oDate.toISOString() }) it('does NOT equal "2000-01-01T00:00:00.000Z"', () => { - expect(dateString).not.toEqual('2000-01-01T00:00:00.000Z') + expect(dateISOString).not.toEqual('2000-01-01T00:00:00.000Z') }) it('coerces -[] as 0, parsing it to "1970-01-01T00:00:00.000Z"', () => { - expect(dateString).toEqual('1970-01-01T00:00:00.000Z') + expect(dateISOString).toEqual('1970-01-01T00:00:00.000Z') }) }) }) From 81c427440d0a8e4eed8b9fe8134397a47e7f55e7 Mon Sep 17 00:00:00 2001 From: JCGuerrero Date: Sat, 4 Oct 2025 17:26:14 -0500 Subject: [PATCH 2/8] f --- __tests__/Date/wtf.unit.spec.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/__tests__/Date/wtf.unit.spec.js b/__tests__/Date/wtf.unit.spec.js index ae542e3..0ebe231 100644 --- a/__tests__/Date/wtf.unit.spec.js +++ b/__tests__/Date/wtf.unit.spec.js @@ -421,7 +421,8 @@ describe('Date', () => { dateISOString = oDate.toISOString() }) - it('does NOT equal "2010-05-01T00:00:00.000"', () => { + // Only works in Non-UTC + xit('does NOT equal "2010-05-01T00:00:00.000"', () => { const expectedDate = new Date('2010-05-01T00:00:00.000') expect(oDate.getTime()).not.toEqual(expectedDate.getTime()) }) From a642bf05828386ef7439ed7c73dd6db191a27a70 Mon Sep 17 00:00:00 2001 From: JCGuerrero Date: Sat, 4 Oct 2025 17:41:33 -0500 Subject: [PATCH 3/8] fff --- __tests__/Date/wtf.unit.spec.js | 34 +++++++++++++++++++-------------- __tests__/global.js | 15 +++++++++++++++ package.json | 4 +++- src/browser-detect.js | 4 ++++ testem.yml | 1 + 5 files changed, 43 insertions(+), 15 deletions(-) create mode 100644 src/browser-detect.js diff --git a/__tests__/Date/wtf.unit.spec.js b/__tests__/Date/wtf.unit.spec.js index 0ebe231..bf202c1 100644 --- a/__tests__/Date/wtf.unit.spec.js +++ b/__tests__/Date/wtf.unit.spec.js @@ -1,3 +1,7 @@ +/** + * @jest-environment jsdom + */ + // SRC: https://jsdate.wtf/ describe('Date', () => { 'use strict' @@ -447,24 +451,26 @@ describe('Date', () => { dateISOString = oDate.toISOString() }) - describe('.toISOString()', () => { - beforeEach(() => { - // NOTE: FireFox throws here: "Invalid Date". - dateISOString = oDate.toISOString() - }) + if (!isFireFox()) { + describe('.toISOString()', () => { + beforeEach(() => { + // NOTE: FireFox throws here: "Invalid Date". + dateISOString = oDate.toISOString() + }) - it('does NOT equal "2010-04-30T23:00:00.000Z"', () => { - expect(dateISOString).not.toEqual('2010-04-30T23:00:00.000Z') - }) + it('does NOT equal "2010-04-30T23:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2010-04-30T23:00:00.000Z') + }) - it('does NOT equal "2010-05-01T00:00:00.000Z"', () => { - expect(dateISOString).not.toEqual('2010-05-01T00:00:00.000Z') - }) + it('does NOT equal "2010-05-01T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2010-05-01T00:00:00.000Z') + }) - it('parses UTC as "2001-05-04T00:00:00.000Z"', () => { - expect(dateISOString).toEqual('2001-05-04T00:00:00.000Z') + it('parses UTC as "2001-05-04T00:00:00.000Z"', () => { + expect(dateISOString).toEqual('2001-05-04T00:00:00.000Z') + }) }) - }) + } }) // 22 of 28 diff --git a/__tests__/global.js b/__tests__/global.js index 8b71eda..48b6bd2 100644 --- a/__tests__/global.js +++ b/__tests__/global.js @@ -1 +1,16 @@ +function isFireFox () { + if (!navigator) { + return false + } + + const userAgent = navigator + .userAgent + .toLowerCase() + + return userAgent.indexOf('firefox') > -1 +} + global._ = require('lodash') + +// A simple function to detect Firefox from the user agent +global.isFireFox = isFireFox diff --git a/package.json b/package.json index 77759e6..c0ada70 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,9 @@ "jest" ], "globals": [ - "_" + "navigator", + "_", + "isFireFox" ] }, "repository": { diff --git a/src/browser-detect.js b/src/browser-detect.js new file mode 100644 index 0000000..09bac28 --- /dev/null +++ b/src/browser-detect.js @@ -0,0 +1,4 @@ +// A simple function to detect Firefox from the user agent +function isFireFox () { + return navigator.userAgent.toLowerCase().indexOf('firefox') > -1; +} diff --git a/testem.yml b/testem.yml index 0275018..d92bac4 100644 --- a/testem.yml +++ b/testem.yml @@ -3,6 +3,7 @@ parallel: 4 ignore_missing_launchers: true src_files: [ 'node_modules/lodash/lodash.min.js', + 'src/browser-detect.js', '__tests__/**/*.unit.spec*.js' ] From 91d86236e095130084e619e4a475539c31a1a1e5 Mon Sep 17 00:00:00 2001 From: JCGuerrero Date: Sat, 4 Oct 2025 19:20:35 -0500 Subject: [PATCH 4/8] f --- __tests__/Date/wtf.unit.spec.js | 271 ++++++++++++++++++++------------ 1 file changed, 169 insertions(+), 102 deletions(-) diff --git a/__tests__/Date/wtf.unit.spec.js b/__tests__/Date/wtf.unit.spec.js index bf202c1..008bd12 100644 --- a/__tests__/Date/wtf.unit.spec.js +++ b/__tests__/Date/wtf.unit.spec.js @@ -262,28 +262,36 @@ describe('Date', () => { oDate = new Date('12.1') }) - describe('.toISOString()', () => { - beforeEach(() => { - // NOTE: FireFox throws here: "Invalid Date". - dateISOString = oDate.toISOString() + if (isFireFox()) { + describe('.toISOString()', () => { + it('throws', () => { + expect(() => oDate.toISOString()).toThrow() + }) }) + } else { + describe('.toISOString()', () => { + beforeEach(() => { + // NOTE: FireFox throws here: "Invalid Date". + dateISOString = oDate.toISOString() + }) - it('does NOT equal "2001-01-01T00:00:00.000Z"', () => { - expect(dateISOString).not.toEqual('2001-01-01T00:00:00.000Z') - }) + it('does NOT equal "2001-01-01T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2001-01-01T00:00:00.000Z') + }) - it('does NOT equal "2012-01-01T00:00:00.000Z"', () => { - expect(dateISOString).not.toEqual('2012-01-01T00:00:00.000Z') - }) + it('does NOT equal "2012-01-01T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2012-01-01T00:00:00.000Z') + }) - it('equals "2001-12-01T00:00:00.000"', () => { - // "12.1" is interpreted as the date December 1st, - // and as before for dates with no year the default is 2001 because of course. - // expect(dateString).toEqual('2001-12-01T00:00:00.000Z') - const expectedDate = new Date('2001-12-01T00:00:00.000') - expect(oDate.getTime()).toEqual(expectedDate.getTime()) + it('equals "2001-12-01T00:00:00.000"', () => { + // "12.1" is interpreted as the date December 1st, + // and as before for dates with no year the default is 2001 because of course. + // expect(dateString).toEqual('2001-12-01T00:00:00.000Z') + const expectedDate = new Date('2001-12-01T00:00:00.000') + expect(oDate.getTime()).toEqual(expectedDate.getTime()) + }) }) - }) + } }) // 15 of 28 @@ -312,27 +320,35 @@ describe('Date', () => { oDate = new Date('12.-1') }) - describe('.toISOString()', () => { - beforeEach(() => { - // NOTE: FireFox throws here "Invalid Date". - dateISOString = oDate.toISOString() + if (isFireFox()) { + describe('.toISOString()', () => { + it('throws', () => { + expect(() => oDate.toISOString()).toThrow() + }) }) + } else { + describe('.toISOString()', () => { + beforeEach(() => { + // NOTE: FireFox throws here "Invalid Date". + dateISOString = oDate.toISOString() + }) - it('does NOT equal "2012-01-01T00:00:00.000Z"', () => { - expect(dateISOString).not.toEqual('2012-01-01T00:00:00.000Z') - }) + it('does NOT equal "2012-01-01T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2012-01-01T00:00:00.000Z') + }) - it('does NOT equal "2001-01-01T00:00:00.000Z"', () => { - expect(dateISOString).not.toEqual('2001-01-01T00:00:00.000Z') - }) + it('does NOT equal "2001-01-01T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2001-01-01T00:00:00.000Z') + }) - it('ignores the "-", interpreting it like "12.1", resulting in "2001-12-01T00:00:00.000"', () => { - // The dash here is ignored, so this is interpreted the same as "12.1". - // expect(dateString).toEqual('2001-12-01T00:00:00.000Z') - const expectedDate = new Date('2001-12-01T00:00:00.000') - expect(oDate.getTime()).toEqual(expectedDate.getTime()) + it('ignores the "-", interpreting it like "12.1", resulting in "2001-12-01T00:00:00.000"', () => { + // The dash here is ignored, so this is interpreted the same as "12.1". + // expect(dateString).toEqual('2001-12-01T00:00:00.000Z') + const expectedDate = new Date('2001-12-01T00:00:00.000') + expect(oDate.getTime()).toEqual(expectedDate.getTime()) + }) }) - }) + } }) // 17 of 28 @@ -387,27 +403,35 @@ describe('Date', () => { oDate = new Date('maybe 1') }) - describe('.toISOString()', () => { - beforeEach(() => { - // NOTE: FireFox throws here: "Invalid Date". - dateISOString = oDate.toISOString() + if (isFireFox()) { + describe('.toISOString()', () => { + it('throws', () => { + expect(() => oDate.toISOString()).toThrow() + }) }) + } else { + describe('.toISOString()', () => { + beforeEach(() => { + // NOTE: FireFox throws here: "Invalid Date". + dateISOString = oDate.toISOString() + }) - // WARNING: The quiz says this is the correct answer! - it('does NOT equal "2001-04-30T23:00:00.000Z"', () => { - expect(dateISOString).not.toEqual('2001-04-30T23:00:00.000Z') - }) + // WARNING: The quiz says this is the correct answer! + it('does NOT equal "2001-04-30T23:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2001-04-30T23:00:00.000Z') + }) - it('does NOT equal "2001-01-01T00:00:00.000Z"', () => { - expect(dateISOString).not.toEqual('2001-01-01T00:00:00.000Z') - }) + it('does NOT equal "2001-01-01T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2001-01-01T00:00:00.000Z') + }) - it('parses "maybe" as "may"! resulting in "2001-05-01T00:00:00.000"', () => { - // expect(dateString).toEqual('2001-05-01T00:00:00.000Z') - const expectedDate = new Date('2001-05-01T00:00:00.000') - expect(oDate.getTime()).toEqual(expectedDate.getTime()) + it('parses "maybe" as "may"! resulting in "2001-05-01T00:00:00.000"', () => { + // expect(dateString).toEqual('2001-05-01T00:00:00.000Z') + const expectedDate = new Date('2001-05-01T00:00:00.000') + expect(oDate.getTime()).toEqual(expectedDate.getTime()) + }) }) - }) + } }) // 20 of 28 @@ -419,28 +443,36 @@ describe('Date', () => { oDate = new Date('fourth of may 2010') }) - describe('.toISOString()', () => { - beforeEach(() => { - // NOTE: FireFox throws here: "Invalid Date". - dateISOString = oDate.toISOString() + if (isFireFox()) { + describe('.toISOString()', () => { + it('throws', () => { + expect(() => oDate.toISOString()).toThrow() + }) }) + } else { + describe('.toISOString()', () => { + beforeEach(() => { + // NOTE: FireFox throws here: "Invalid Date". + dateISOString = oDate.toISOString() + }) - // Only works in Non-UTC - xit('does NOT equal "2010-05-01T00:00:00.000"', () => { - const expectedDate = new Date('2010-05-01T00:00:00.000') - expect(oDate.getTime()).not.toEqual(expectedDate.getTime()) - }) + // Only works in Non-UTC + xit('does NOT equal "2010-05-01T00:00:00.000"', () => { + const expectedDate = new Date('2010-05-01T00:00:00.000') + expect(oDate.getTime()).not.toEqual(expectedDate.getTime()) + }) - it('does NOT equal "2010-05-04T00:00:00.000Z"', () => { - expect(dateISOString).not.toEqual('2010-05-04T00:00:00.000Z') - }) + it('does NOT equal "2010-05-04T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2010-05-04T00:00:00.000Z') + }) - it('ignores "fourth of", parsing "may 2010" as "2010-05-01T00:00:00.000"', () => { - // expect(dateString).toEqual('2010-05-01T00:00:00.000Z') - const expectedDate = new Date('2010-05-01T00:00:00.000') - expect(oDate.getTime()).toEqual(expectedDate.getTime()) + it('ignores "fourth of", parsing "may 2010" as "2010-05-01T00:00:00.000"', () => { + // expect(dateString).toEqual('2010-05-01T00:00:00.000Z') + const expectedDate = new Date('2010-05-01T00:00:00.000') + expect(oDate.getTime()).toEqual(expectedDate.getTime()) + }) }) - }) + } }) // 21 of 28 @@ -451,7 +483,13 @@ describe('Date', () => { dateISOString = oDate.toISOString() }) - if (!isFireFox()) { + if (isFireFox()) { + describe('.toISOString()', () => { + it('throws', () => { + expect(() => oDate.toISOString()).toThrow() + }) + }) + } else { describe('.toISOString()', () => { beforeEach(() => { // NOTE: FireFox throws here: "Invalid Date". @@ -478,28 +516,35 @@ describe('Date', () => { beforeEach(() => { // You can add modifiers to timezones and it works as you would expect. oDate = new Date('May 4 UTC+1') - dateISOString = oDate.toISOString() }) - describe('.toISOString()', () => { - beforeEach(() => { - // NOTE: FireFox throws here: "Invalid Date". - dateISOString = oDate.toISOString() + if (isFireFox()) { + describe('.toISOString()', () => { + it('throws', () => { + expect(() => oDate.toISOString()).toThrow() + }) }) + } else { + describe('.toISOString()', () => { + beforeEach(() => { + // NOTE: FireFox throws here: "Invalid Date". + dateISOString = oDate.toISOString() + }) - it('does NOT equal "2001-05-04T00:00:00.000Z"', () => { - expect(dateISOString).not.toEqual('2001-05-04T00:00:00.000Z') - }) + it('does NOT equal "2001-05-04T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2001-05-04T00:00:00.000Z') + }) - it('does NOT equal "2010-05-01T00:00:00.000Z"', () => { - expect(dateISOString).not.toEqual('2010-05-01T00:00:00.000Z') - }) + it('does NOT equal "2010-05-01T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2010-05-01T00:00:00.000Z') + }) - it('parses UTC+1 as "2001-05-04T00:00:00.000", resulting in "2001-05-03T23:00:00.000Z"', () => { - // 05-04T00 @ UTC+1 is 1 hr ahead: 05-03T23 @ UTC - expect(dateISOString).toEqual('2001-05-03T23:00:00.000Z') + it('parses UTC+1 as "2001-05-04T00:00:00.000", resulting in "2001-05-03T23:00:00.000Z"', () => { + // 05-04T00 @ UTC+1 is 1 hr ahead: 05-03T23 @ UTC + expect(dateISOString).toEqual('2001-05-03T23:00:00.000Z') + }) }) - }) + } }) // 23 of 28 @@ -509,20 +554,28 @@ describe('Date', () => { oDate = new Date('May 4 UTC+1:59') }) - describe('.toISOString()', () => { - beforeEach(() => { - // NOTE: FireFox throws here: "Invalid Date". - dateISOString = oDate.toISOString() + if (isFireFox()) { + describe('.toISOString()', () => { + it('throws', () => { + expect(() => oDate.toISOString()).toThrow() + }) }) + } else { + describe('.toISOString()', () => { + beforeEach(() => { + // NOTE: FireFox throws here: "Invalid Date". + dateISOString = oDate.toISOString() + }) - it('does NOT equal "2001-05-04T00:00:00.000Z"', () => { - expect(dateISOString).not.toEqual('2001-05-04T00:00:00.000Z') - }) + it('does NOT equal "2001-05-04T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2001-05-04T00:00:00.000Z') + }) - it('parses UTC+1:59 as "2001-05-04T00:00:00.000", resulting in "2001-05-03T22:01:00.000Z"', () => { - expect(dateISOString).toEqual('2001-05-03T22:01:00.000Z') + it('parses UTC+1:59 as "2001-05-04T00:00:00.000", resulting in "2001-05-03T22:01:00.000Z"', () => { + expect(dateISOString).toEqual('2001-05-03T22:01:00.000Z') + }) }) - }) + } }) // 24 of 28 @@ -532,20 +585,34 @@ describe('Date', () => { // 60 is being parsed as the year here, // UTC+1 is the timezone. oDate = new Date('May 4 UTC+1:60') - dateISOString = oDate.toISOString() }) - it('does NOT equal "2001-05-04T00:00:00.000Z"', () => { - expect(dateISOString).not.toEqual('2001-05-04T00:00:00.000Z') - }) + if (isFireFox()) { + describe('.toISOString()', () => { + it('throws', () => { + expect(() => oDate.toISOString()).toThrow() + }) + }) + } else { + describe('.toISOString()', () => { + beforeEach(() => { + // NOTE: FireFox throws here: "Invalid Date". + dateISOString = oDate.toISOString() + }) - it('does NOT equal "2001-05-03T22:00:00.000Z"', () => { - expect(dateISOString).not.toEqual('2001-05-03T22:00:00.000Z') - }) + it('does NOT equal "2001-05-04T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2001-05-04T00:00:00.000Z') + }) - it('parses UTC+1:60 as "UTC+1" AND "year 60"!, resulting in "1960-05-03T23:00:00.000Z"', () => { - expect(dateISOString).toEqual('1960-05-03T23:00:00.000Z') - }) + it('does NOT equal "2001-05-03T22:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2001-05-03T22:00:00.000Z') + }) + + it('parses UTC+1:60 as "UTC+1" AND "year 60"!, resulting in "1960-05-03T23:00:00.000Z"', () => { + expect(dateISOString).toEqual('1960-05-03T23:00:00.000Z') + }) + }) + } }) // 25 of 28 From 5bea5dfbbe18e8ede0cc317a55377006ad94dc0c Mon Sep 17 00:00:00 2001 From: JCGuerrero Date: Sat, 4 Oct 2025 19:21:37 -0500 Subject: [PATCH 5/8] f --- __tests__/Date/wtf.unit.spec.js | 35 ++++++++++++--------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/__tests__/Date/wtf.unit.spec.js b/__tests__/Date/wtf.unit.spec.js index 008bd12..6729aad 100644 --- a/__tests__/Date/wtf.unit.spec.js +++ b/__tests__/Date/wtf.unit.spec.js @@ -480,7 +480,6 @@ describe('Date', () => { beforeEach(() => { // UTC is correctly parsed as a timezone. oDate = new Date('May 4 UTC') - dateISOString = oDate.toISOString() }) if (isFireFox()) { @@ -587,32 +586,24 @@ describe('Date', () => { oDate = new Date('May 4 UTC+1:60') }) - if (isFireFox()) { - describe('.toISOString()', () => { - it('throws', () => { - expect(() => oDate.toISOString()).toThrow() - }) + describe('.toISOString()', () => { + beforeEach(() => { + // NOTE: FireFox throws here: "Invalid Date". + dateISOString = oDate.toISOString() }) - } else { - describe('.toISOString()', () => { - beforeEach(() => { - // NOTE: FireFox throws here: "Invalid Date". - dateISOString = oDate.toISOString() - }) - it('does NOT equal "2001-05-04T00:00:00.000Z"', () => { - expect(dateISOString).not.toEqual('2001-05-04T00:00:00.000Z') - }) + it('does NOT equal "2001-05-04T00:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2001-05-04T00:00:00.000Z') + }) - it('does NOT equal "2001-05-03T22:00:00.000Z"', () => { - expect(dateISOString).not.toEqual('2001-05-03T22:00:00.000Z') - }) + it('does NOT equal "2001-05-03T22:00:00.000Z"', () => { + expect(dateISOString).not.toEqual('2001-05-03T22:00:00.000Z') + }) - it('parses UTC+1:60 as "UTC+1" AND "year 60"!, resulting in "1960-05-03T23:00:00.000Z"', () => { - expect(dateISOString).toEqual('1960-05-03T23:00:00.000Z') - }) + it('parses UTC+1:60 as "UTC+1" AND "year 60"!, resulting in "1960-05-03T23:00:00.000Z"', () => { + expect(dateISOString).toEqual('1960-05-03T23:00:00.000Z') }) - } + }) }) // 25 of 28 From 57ffb28f028524464bcd28a5dfb816cea629715a Mon Sep 17 00:00:00 2001 From: JCGuerrero Date: Sat, 4 Oct 2025 19:25:21 -0500 Subject: [PATCH 6/8] f --- __tests__/Date/wtf.unit.spec.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/__tests__/Date/wtf.unit.spec.js b/__tests__/Date/wtf.unit.spec.js index 6729aad..1a996e5 100644 --- a/__tests__/Date/wtf.unit.spec.js +++ b/__tests__/Date/wtf.unit.spec.js @@ -262,8 +262,8 @@ describe('Date', () => { oDate = new Date('12.1') }) - if (isFireFox()) { - describe('.toISOString()', () => { + if (isFireFox()) { // v 143.0 + describe('.toISOString() @ FireFox', () => { it('throws', () => { expect(() => oDate.toISOString()).toThrow() }) @@ -320,8 +320,8 @@ describe('Date', () => { oDate = new Date('12.-1') }) - if (isFireFox()) { - describe('.toISOString()', () => { + if (isFireFox()) { // v 143.0 + describe('.toISOString() @ FireFox', () => { it('throws', () => { expect(() => oDate.toISOString()).toThrow() }) @@ -403,8 +403,8 @@ describe('Date', () => { oDate = new Date('maybe 1') }) - if (isFireFox()) { - describe('.toISOString()', () => { + if (isFireFox()) { // v 143.0 + describe('.toISOString() @ FireFox', () => { it('throws', () => { expect(() => oDate.toISOString()).toThrow() }) @@ -443,8 +443,8 @@ describe('Date', () => { oDate = new Date('fourth of may 2010') }) - if (isFireFox()) { - describe('.toISOString()', () => { + if (isFireFox()) { // v 143.0 + describe('.toISOString() @ FireFox', () => { it('throws', () => { expect(() => oDate.toISOString()).toThrow() }) @@ -482,8 +482,8 @@ describe('Date', () => { oDate = new Date('May 4 UTC') }) - if (isFireFox()) { - describe('.toISOString()', () => { + if (isFireFox()) { // v 143.0 + describe('.toISOString() @ FireFox', () => { it('throws', () => { expect(() => oDate.toISOString()).toThrow() }) @@ -517,8 +517,8 @@ describe('Date', () => { oDate = new Date('May 4 UTC+1') }) - if (isFireFox()) { - describe('.toISOString()', () => { + if (isFireFox()) { // v 143.0 + describe('.toISOString() @ FireFox', () => { it('throws', () => { expect(() => oDate.toISOString()).toThrow() }) @@ -553,8 +553,8 @@ describe('Date', () => { oDate = new Date('May 4 UTC+1:59') }) - if (isFireFox()) { - describe('.toISOString()', () => { + if (isFireFox()) { // v 143.0 + describe('.toISOString() @ FireFox', () => { it('throws', () => { expect(() => oDate.toISOString()).toThrow() }) From 53151c8eab2afde9198f88afa580659dc1378abb Mon Sep 17 00:00:00 2001 From: JCGuerrero Date: Sat, 4 Oct 2025 19:27:40 -0500 Subject: [PATCH 7/8] f --- __tests__/Date/wtf.unit.spec.js | 98 ++++++++++++++++++++++++++------- 1 file changed, 77 insertions(+), 21 deletions(-) diff --git a/__tests__/Date/wtf.unit.spec.js b/__tests__/Date/wtf.unit.spec.js index 1a996e5..91ac5b9 100644 --- a/__tests__/Date/wtf.unit.spec.js +++ b/__tests__/Date/wtf.unit.spec.js @@ -263,9 +263,17 @@ describe('Date', () => { }) if (isFireFox()) { // v 143.0 - describe('.toISOString() @ FireFox', () => { - it('throws', () => { - expect(() => oDate.toISOString()).toThrow() + describe('@FireFox', () => { + describe('.toISOString()', () => { + it('throws', () => { + expect(() => oDate.toISOString()).toThrow() + }) + }) + + describe('.toTimeString()', () => { + it('equals "Invalid Date"', () => { + expect(dateTimeString).toEqual('Invalid Date') + }) }) }) } else { @@ -321,9 +329,17 @@ describe('Date', () => { }) if (isFireFox()) { // v 143.0 - describe('.toISOString() @ FireFox', () => { - it('throws', () => { - expect(() => oDate.toISOString()).toThrow() + describe('@FireFox', () => { + describe('.toISOString()', () => { + it('throws', () => { + expect(() => oDate.toISOString()).toThrow() + }) + }) + + describe('.toTimeString()', () => { + it('equals "Invalid Date"', () => { + expect(dateTimeString).toEqual('Invalid Date') + }) }) }) } else { @@ -404,9 +420,17 @@ describe('Date', () => { }) if (isFireFox()) { // v 143.0 - describe('.toISOString() @ FireFox', () => { - it('throws', () => { - expect(() => oDate.toISOString()).toThrow() + describe('@FireFox', () => { + describe('.toISOString()', () => { + it('throws', () => { + expect(() => oDate.toISOString()).toThrow() + }) + }) + + describe('.toTimeString()', () => { + it('equals "Invalid Date"', () => { + expect(dateTimeString).toEqual('Invalid Date') + }) }) }) } else { @@ -444,9 +468,17 @@ describe('Date', () => { }) if (isFireFox()) { // v 143.0 - describe('.toISOString() @ FireFox', () => { - it('throws', () => { - expect(() => oDate.toISOString()).toThrow() + describe('@FireFox', () => { + describe('.toISOString()', () => { + it('throws', () => { + expect(() => oDate.toISOString()).toThrow() + }) + }) + + describe('.toTimeString()', () => { + it('equals "Invalid Date"', () => { + expect(dateTimeString).toEqual('Invalid Date') + }) }) }) } else { @@ -483,9 +515,17 @@ describe('Date', () => { }) if (isFireFox()) { // v 143.0 - describe('.toISOString() @ FireFox', () => { - it('throws', () => { - expect(() => oDate.toISOString()).toThrow() + describe('@FireFox', () => { + describe('.toISOString()', () => { + it('throws', () => { + expect(() => oDate.toISOString()).toThrow() + }) + }) + + describe('.toTimeString()', () => { + it('equals "Invalid Date"', () => { + expect(dateTimeString).toEqual('Invalid Date') + }) }) }) } else { @@ -518,9 +558,17 @@ describe('Date', () => { }) if (isFireFox()) { // v 143.0 - describe('.toISOString() @ FireFox', () => { - it('throws', () => { - expect(() => oDate.toISOString()).toThrow() + describe('@FireFox', () => { + describe('.toISOString()', () => { + it('throws', () => { + expect(() => oDate.toISOString()).toThrow() + }) + }) + + describe('.toTimeString()', () => { + it('equals "Invalid Date"', () => { + expect(dateTimeString).toEqual('Invalid Date') + }) }) }) } else { @@ -554,9 +602,17 @@ describe('Date', () => { }) if (isFireFox()) { // v 143.0 - describe('.toISOString() @ FireFox', () => { - it('throws', () => { - expect(() => oDate.toISOString()).toThrow() + describe('@FireFox', () => { + describe('.toISOString()', () => { + it('throws', () => { + expect(() => oDate.toISOString()).toThrow() + }) + }) + + describe('.toTimeString()', () => { + it('equals "Invalid Date"', () => { + expect(dateTimeString).toEqual('Invalid Date') + }) }) }) } else { From de1a82825ad82ef7b644f05f7c7f418bdaf46d82 Mon Sep 17 00:00:00 2001 From: JCGuerrero Date: Sat, 4 Oct 2025 19:32:24 -0500 Subject: [PATCH 8/8] s --- src/browser-detect.js | 4 ---- testem.yml | 1 - 2 files changed, 5 deletions(-) delete mode 100644 src/browser-detect.js diff --git a/src/browser-detect.js b/src/browser-detect.js deleted file mode 100644 index 09bac28..0000000 --- a/src/browser-detect.js +++ /dev/null @@ -1,4 +0,0 @@ -// A simple function to detect Firefox from the user agent -function isFireFox () { - return navigator.userAgent.toLowerCase().indexOf('firefox') > -1; -} diff --git a/testem.yml b/testem.yml index d92bac4..0275018 100644 --- a/testem.yml +++ b/testem.yml @@ -3,7 +3,6 @@ parallel: 4 ignore_missing_launchers: true src_files: [ 'node_modules/lodash/lodash.min.js', - 'src/browser-detect.js', '__tests__/**/*.unit.spec*.js' ]