Bug 1724966 - Fix newtab test setup to be independent of timezones r=Mardak

Differential Revision: https://phabricator.services.mozilla.com/D122286
This commit is contained in:
Andrei Oprea 2021-08-11 09:14:28 +00:00
Родитель 0672b9f476
Коммит 962fb81710
1 изменённых файлов: 4 добавлений и 6 удалений

Просмотреть файл

@ -346,19 +346,17 @@ describe("#mainPingSubmissions", () => {
);
});
it("should allow for pings < 24hrs apart but on different days", async () => {
let startTime = new Date("2020-02-20").getTime();
let oneDay = 86400000;
let startTime = new Date().setHours(0);
let previousDay = new Date(startTime - 60 * 60 * 1000).getTime();
promiseArchivedPingList = sandbox.stub().resolves([
{
id: "5c8c786b-eca5-734b-a755-7ec0f022aaaa",
// Using oneDay / 2 because timezone of browser running the test
// affects the calculation
timestampCreated: startTime - oneDay / 2,
timestampCreated: startTime,
type: "main",
},
{
id: "5c8c786b-eca5-734b-a755-7ec0f022aaac",
timestampCreated: startTime + 1000,
timestampCreated: previousDay,
type: "main",
},
]);