diff --git a/TeamspeakStatsNew/TeamspeakStatsNew/ClientApp/src/app/fetch-data/fetch-data.component.spec.ts b/TeamspeakStatsNew/TeamspeakStatsNew/ClientApp/src/app/fetch-data/fetch-data.component.spec.ts index fd4275c..d1040e6 100644 --- a/TeamspeakStatsNew/TeamspeakStatsNew/ClientApp/src/app/fetch-data/fetch-data.component.spec.ts +++ b/TeamspeakStatsNew/TeamspeakStatsNew/ClientApp/src/app/fetch-data/fetch-data.component.spec.ts @@ -231,6 +231,8 @@ describe("FetchDataComponent", () => { component.sortData(SortTime.AllTime); const date = new Date(); date.setFullYear(1); + date.setMilliseconds(0); + component.dateToCountHoursFrom.setMilliseconds(0); expect(component.dateToCountHoursFrom).toEqual(date); }); @@ -429,6 +431,14 @@ describe("FetchDataComponent", () => { expect(component.sortDirection).toBe(1); }); + function removeMsFromISOString(ISOstring: string): string { + const indexOfDot = ISOstring.indexOf("."); + if (indexOfDot !== -1) { + return ISOstring.substring(0, indexOfDot) + "Z"; + } + return ISOstring; + } + interface Stats { id: number; latestName: string; diff --git a/TeamspeakStatsNew/TeamspeakStatsNew/ClientApp/src/app/fetch-graphs/fetch-graph.component.spec.ts b/TeamspeakStatsNew/TeamspeakStatsNew/ClientApp/src/app/fetch-graphs/fetch-graph.component.spec.ts index 2673af1..7f57d15 100644 --- a/TeamspeakStatsNew/TeamspeakStatsNew/ClientApp/src/app/fetch-graphs/fetch-graph.component.spec.ts +++ b/TeamspeakStatsNew/TeamspeakStatsNew/ClientApp/src/app/fetch-graphs/fetch-graph.component.spec.ts @@ -61,8 +61,12 @@ describe("VymazatComponent", () => { it("should get current time as ISO string", () => { const currentDate: Date = new Date(); - const currentDateISO = currentDate.toISOString(); - expect(component.getCurrentTimeAsIsoString()).toBe(currentDateISO); + const currentDateISO = removeMsFromISOString(currentDate.toISOString()); + const returnedISOString = removeMsFromISOString( + component.getCurrentTimeAsIsoString() + ); + + expect(returnedISOString).toBe(currentDateISO); }); it("should get graph data latest sorted by month", () => { @@ -177,6 +181,14 @@ describe("VymazatComponent", () => { expect(localStorageMock["stats-etag"]).toBe("new-etag"); }); + function removeMsFromISOString(ISOstring: string): string { + const indexOfDot = ISOstring.indexOf("."); + if (indexOfDot !== -1) { + return ISOstring.substring(0, indexOfDot) + "Z"; + } + return ISOstring; + } + enum SortTime { Year = "year", Month = "month",