-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #374 from Enterprise-CMCS/val
Release to production
- Loading branch information
Showing
60 changed files
with
4,852 additions
and
1,587 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--- | ||
layout: default | ||
title: Code Style Cheatsheet | ||
parent: Team Norms | ||
nav_order: 2 | ||
--- | ||
|
||
# Code Style | ||
|
||
### What is it? | ||
|
||
A set of rules or guidelines used when writing the source code for a computer program. | ||
|
||
### Why is it? | ||
|
||
It keeps the code looking neat and tidy, so anyone on the team can jump in and not | ||
get lost in a jungle of curly braces and indentation levels. It's like everyone speaking | ||
the same slang in a super cool secret club. Plus, it saves time from arguing over trivial | ||
stuff, like whether tabs are better than spaces, so there's more time for the fun | ||
stuff—coding and creating! | ||
|
||
# OneMAC Style Norms | ||
|
||
## Cheatsheet | ||
|
||
TL;DR? No worries, here's a cheatsheet of the concepts outlined below: | ||
|
||
- [DO NOT destructure](#object-access) so we maintain object context for methods and properties used in code | ||
|
||
### Object Access | ||
|
||
When integrating with complex objects, consider maintaining the object's integrity rather | ||
than opting for destructuring. This approach ensures that the object's context is | ||
preserved, enhancing readability and maintainability. | ||
|
||
#### Nomenclature simplification | ||
|
||
For instance, rather than breaking | ||
down the object into individual variables, which can lead to verbose and confusing naming | ||
conventions, maintain the object as a whole. | ||
|
||
```typescript jsx | ||
const { | ||
setModalOpen, | ||
setContent: setModalContent, | ||
setOnAccept: setModalOnAccept, | ||
} = useModalContext(); | ||
const { | ||
setContent: setBannerContent, | ||
setBannerShow, | ||
setBannerDisplayOn, | ||
} = useAlertContext(); | ||
|
||
// vs | ||
|
||
const modal = useModalContext(); | ||
const alert = useAlertContext(); | ||
``` | ||
|
||
#### Usage implication | ||
|
||
This method simplifies reference to its properties and methods, providing a clearer and | ||
more direct understanding of its usage within the code. This strategy is particularly | ||
beneficial in scenarios where the object's structure and context significantly contribute | ||
to its functionality and meaning in the application. | ||
|
||
```typescript jsx | ||
<form | ||
onSubmit={form.handleSubmit(async (data) => { | ||
try { | ||
await submit({ | ||
//... | ||
}); | ||
alert.setContent({ | ||
header: "RAI response submitted", | ||
body: `The RAI response for ${item._source.id} has been submitted.`, | ||
}); | ||
alert.setBannerShow(true); | ||
alert.setBannerDisplayOn("/dashboard"); | ||
navigate({ path: "/dashboard" }); | ||
} catch (e) { | ||
//... | ||
} | ||
})} | ||
> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
export enum PlanType { | ||
MED_SPA = "medicaid spa", | ||
CHIP_SPA = "chip spa", | ||
WAIVER = "waiver", | ||
"1915b" = "1915(b)", | ||
"1915c" = "1915(c)", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/packages/shared-utils/tests/seatool-date-helper.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { it, describe, expect } from "vitest"; | ||
import { getNextBusinessDayTimestamp } from "../seatool-date-helper"; | ||
|
||
describe("The getNextBusinessDayTimestamp function", () => { | ||
it("identifies weekenends", () => { | ||
let testDate = new Date(2024, 0, 27, 12, 0, 0); // Saturday, noon, utc | ||
let nextDate = getNextBusinessDayTimestamp(testDate); | ||
expect(nextDate).toEqual(Date.UTC(2024, 0, 29)); // Monday, midnight, utc | ||
}); | ||
|
||
it("identifies holidays", () => { | ||
let testDate = new Date(2024, 0, 15, 12, 0, 0); // MLK Day, a Monday | ||
let nextDate = getNextBusinessDayTimestamp(testDate); | ||
expect(nextDate).toEqual(Date.UTC(2024, 0, 16)); // Tuesday, midnight, utc | ||
}); | ||
|
||
it("identifies submissions after 5pm eastern", () => { | ||
let testDate = new Date(2024, 0, 17, 23, 0, 0); // Wednesday 11pm utc, Wednesday 6pm eastern | ||
let nextDate = getNextBusinessDayTimestamp(testDate); | ||
expect(nextDate).toEqual(Date.UTC(2024, 0, 18)); // Thursday, midnight, utc | ||
}); | ||
|
||
it("identifies submissions before 5pm eastern", () => { | ||
let testDate = new Date(2024, 0, 17, 10, 0, 0); // Wednesday 10am utc, Wednesday 5am eastern | ||
let nextDate = getNextBusinessDayTimestamp(testDate); | ||
expect(nextDate).toEqual(Date.UTC(2024, 0, 17)); // Wednesday, midnight, utc | ||
}); | ||
|
||
it("handles combinations of rule violations", () => { | ||
let testDate = new Date(2024, 0, 12, 23, 0, 0); // Friday 11pm utc, Friday 6pm eastern | ||
let nextDate = getNextBusinessDayTimestamp(testDate); | ||
// Submission is after 5pm, Saturday is a weekend, Sunday is a weekend, and Monday is MLK Day | ||
expect(nextDate).toEqual(Date.UTC(2024, 0, 16)); // Tuesday, midnight utc | ||
}); | ||
|
||
it("identifies valid business days", () => { | ||
let testDate = new Date(2024, 0, 9, 15, 0, 0); // Tuesday 3pm utc, Tuesday 8am eastern | ||
let nextDate = getNextBusinessDayTimestamp(testDate); | ||
expect(nextDate).toEqual(Date.UTC(2024, 0, 9)); // Tuesday, midnight utc | ||
}); | ||
|
||
}); |
Oops, something went wrong.