Highlight seasonal Community Center priorities
This commit is contained in:
parent
8d5a94d7fa
commit
d2c7f004ea
8 changed files with 199 additions and 16 deletions
44
tests/test_availability.js
Normal file
44
tests/test_availability.js
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
const assert = require("node:assert/strict");
|
||||
const availability = require("../static/availability.js");
|
||||
|
||||
const walleye = {
|
||||
id: "fish-walleye",
|
||||
meta: "River/Lake · 12pm–2am · rain",
|
||||
seasons: ["fall"]
|
||||
};
|
||||
const fallWindow = availability.classify(walleye, {
|
||||
checked: false,
|
||||
chooseGroupComplete: false,
|
||||
season: "fall"
|
||||
});
|
||||
assert.equal(fallWindow.needed, true);
|
||||
assert.equal(fallWindow.availableNow, true);
|
||||
assert.equal(fallWindow.seasonExclusive, true);
|
||||
assert.equal(fallWindow.weather, "Rain");
|
||||
assert.equal(availability.matchesFilter(fallWindow, "now"), true);
|
||||
assert.equal(availability.matchesFilter(fallWindow, "exclusive"), true);
|
||||
assert.equal(availability.matchesFilter(fallWindow, "weather"), true);
|
||||
|
||||
const springWalleye = availability.classify(walleye, {
|
||||
checked: false,
|
||||
chooseGroupComplete: false,
|
||||
season: "spring"
|
||||
});
|
||||
assert.equal(springWalleye.availableNow, false);
|
||||
assert.equal(availability.matchesFilter(springWalleye, "now"), false);
|
||||
assert.equal(availability.matchesFilter(springWalleye, "weather"), false);
|
||||
|
||||
const optionalChoice = availability.classify({
|
||||
id: "crab-clam",
|
||||
meta: "Ocean crab pot",
|
||||
seasons: []
|
||||
}, {
|
||||
checked: false,
|
||||
chooseGroupComplete: true,
|
||||
season: "spring"
|
||||
});
|
||||
assert.equal(optionalChoice.needed, false);
|
||||
assert.equal(availability.matchesFilter(optionalChoice, "open"), false);
|
||||
assert.equal(availability.matchesFilter(optionalChoice, "now"), false);
|
||||
|
||||
console.log("availability tests passed");
|
||||
Loading…
Add table
Add a link
Reference in a new issue