Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
update test dates to a friday
Browse files Browse the repository at this point in the history
  • Loading branch information
zimeg committed Sep 27, 2023
1 parent 8365131 commit dba9a61
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions functions/collect_runner_stats_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import { DatastoreItem } from "deno-slack-api/types.ts";
import RunningDatastore from "../datastores/run_data.ts";

// Mocked date for stable testing
Date.now = () => new Date("2023-01-04").getTime();
Date.now = () => new Date("2023-01-06").getTime();

// Collection of runs stored in the mocked datastore
const mockRuns: DatastoreItem<typeof RunningDatastore.definition>[] = [
{ id: "R006", runner: "U0123456", distance: 4, rundate: "2023-01-04" },
{ id: "R005", runner: "U0123456", distance: 2, rundate: "2023-01-04" },
{ id: "R004", runner: "U7777777", distance: 2, rundate: "2023-01-02" },
{ id: "R003", runner: "U0123456", distance: 4, rundate: "2023-01-02" },
{ id: "R006", runner: "U0123456", distance: 4, rundate: "2023-01-06" },
{ id: "R005", runner: "U0123456", distance: 2, rundate: "2023-01-06" },
{ id: "R004", runner: "U7777777", distance: 2, rundate: "2023-01-03" },
{ id: "R003", runner: "U0123456", distance: 4, rundate: "2022-12-31" },
{ id: "R002", runner: "U7777777", distance: 1, rundate: "2022-12-10" },
{ id: "R001", runner: "U0123456", distance: 2, rundate: "2022-11-11" },
];
Expand Down
10 changes: 5 additions & 5 deletions functions/collect_team_stats_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import CollectTeamStatsFunction from "./collect_team_stats.ts";
import RunningDatastore from "../datastores/run_data.ts";

// Mocked date for stable testing
Date.now = () => new Date("2023-01-04").getTime();
Date.now = () => new Date("2023-01-06").getTime();

// Collection of runs stored in the mocked datastore
let mockRuns: DatastoreItem<typeof RunningDatastore.definition>[];
Expand Down Expand Up @@ -37,11 +37,11 @@ Deno.test("Retrieve the empty set", async () => {

Deno.test("Count only runs from the past week", async () => {
mockRuns = [
{ id: "R006", runner: "U0123456", distance: 8, rundate: "2023-01-05" },
{ id: "R005", runner: "U0123456", distance: 4, rundate: "2023-01-04" },
{ id: "R006", runner: "U0123456", distance: 8, rundate: "2023-01-07" },
{ id: "R005", runner: "U0123456", distance: 4, rundate: "2023-01-06" },
{ id: "R004", runner: "U7777777", distance: 2, rundate: "2023-01-02" },
{ id: "R003", runner: "U0123456", distance: 4, rundate: "2022-12-31" },
{ id: "R002", runner: "U7777777", distance: 6, rundate: "2022-12-29" },
{ id: "R002", runner: "U7777777", distance: 6, rundate: "2022-12-31" },
{ id: "R001", runner: "U8888888", distance: 1, rundate: "2022-12-28" },
];
const { outputs, error } = await CollectTeamStatsFunction(
Expand All @@ -54,7 +54,7 @@ Deno.test("Count only runs from the past week", async () => {

Deno.test("Handle the infinite change", async () => {
mockRuns = [
{ id: "R001", runner: "U0123456", distance: 10, rundate: "2023-01-04" },
{ id: "R001", runner: "U0123456", distance: 10, rundate: "2023-01-05" },
];
const { outputs, error } = await CollectTeamStatsFunction(
createContext({ inputs: {} }),
Expand Down
2 changes: 1 addition & 1 deletion functions/log_run_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Deno.test("Successfully save a run", async () => {
const inputs = {
runner: "U0123456",
distance: 4,
rundate: "2022-01-22",
rundate: "2023-01-13",
};

const { error } = await LogRunFunction(createContext({ inputs }));
Expand Down

0 comments on commit dba9a61

Please sign in to comment.