Skip to content

Commit

Permalink
Merge pull request #474 from 18F/holiday-work-reminder
Browse files Browse the repository at this point in the history
Remind people not to overwork themselves in holiday weeks
  • Loading branch information
mgwalker authored Nov 4, 2022
2 parents 504c0fa + c25666b commit 1c15ac9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
14 changes: 13 additions & 1 deletion src/scripts/federal-holidays-reminder.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ const {
helpMessage,
} = require("../utils");

const workLessMessages = [
"Only do 32 hours worth of work since there are only 32 hours to do them in!",
"This is your permission to cancel some meetings and only do 32 hours of work for the holiday week!",
"Don't try to fit 40 hours of work into the holiday week 32-hour week!",
"Observe it the way that is most appropriate to you, and claim that 8 hours for yourself.",
"Work at your normal pace for the week and only do 32 hours worth!",
"Time is not compressed; it's just gone! So you can also get rid of 8 hours worth of work.",
"32 high-quality work hours are preferable to 40 hours worth of exhausted work crammed into 32 hours!",
];

// The first argument is always the bot object. We don't actually need it for
// this script, so capture and toss it out.
const scheduleReminder = (_, config = process.env) => {
Expand Down Expand Up @@ -44,7 +54,9 @@ const scheduleReminder = (_, config = process.env) => {
"dddd"
)}* is a federal holiday in observance of *${
holiday.alsoObservedAs ?? holiday.name
}*${emoji ? ` ${emoji}` : ""}!`,
}*${emoji ? ` ${emoji}` : ""}! ${
workLessMessages[Math.floor(Math.random() * workLessMessages.length)]
}`,
});
};

Expand Down
12 changes: 9 additions & 3 deletions src/scripts/federal-holidays-reminder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ describe("holiday reminder", () => {

expect(postMessage).toHaveBeenCalledWith({
channel: "general",
text: "<!here|here> Remember that *Thursday* is a federal holiday in observance of *test holiday*!",
text: expect.stringMatching(
/^<!here\|here> Remember that \*Thursday\* is a federal holiday in observance of \*test holiday\*! .+$/
),
});

// Sets up a job for tomorrow to schedule the next reminder. Because the
Expand All @@ -124,7 +126,9 @@ describe("holiday reminder", () => {

expect(postMessage).toHaveBeenCalledWith({
channel: "test channel",
text: "<!here|here> Remember that *Thursday* is a federal holiday in observance of *test holiday*!",
text: expect.stringMatching(
/^<!here\|here> Remember that \*Thursday\* is a federal holiday in observance of \*test holiday\*! .+$/
),
});

// Sets up a job for tomorrow to schedule the next reminder
Expand All @@ -140,7 +144,9 @@ describe("holiday reminder", () => {

expect(postMessage).toHaveBeenCalledWith({
channel: "general",
text: "<!here|here> Remember that *Thursday* is a federal holiday in observance of *Veterans Day* :salute-you:!",
text: expect.stringMatching(
/^<!here|here> Remember that \*Thursday\* is a federal holiday in observance of \*Veterans Day\* :salute-you:! .+$/
),
});

// Sets up a job for tomorrow to schedule the next reminder
Expand Down

0 comments on commit 1c15ac9

Please sign in to comment.