-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(readme): typescript implementation of examples in readme
- Loading branch information
Jack Hopkins
committed
Jan 23, 2024
1 parent
057a261
commit ee64724
Showing
5 changed files
with
181 additions
and
97 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
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,51 @@ | ||
// Define the ActionItem class | ||
import { patch, Tanuki } from "../../src/tanuki"; | ||
|
||
class ActionItem { | ||
goal: string; | ||
deadline: Date; | ||
|
||
constructor(goal: string, deadline: Date) { | ||
this.goal = goal; | ||
this.deadline = deadline; | ||
} | ||
} | ||
|
||
// Assuming we have a similar setup for the patch and align methods | ||
class Functions { | ||
actionItems = patch<ActionItem[], string>()`Generate a list of Action Items`; | ||
} | ||
|
||
describe('Instantiate Class Tests', () => { | ||
|
||
// Assuming tanuki.align functionality is handled within the test itself | ||
it('align_action_items', async () => { | ||
Tanuki.align(async (it) => { | ||
it("alignActionItems", async (expect) => { | ||
const goal = "Can you please get the presentation to me by Tuesday?"; | ||
const nextTuesday = new Date(); | ||
nextTuesday.setDate(nextTuesday.getDate() + ((1 - nextTuesday.getDay() + 7) % 7)); | ||
nextTuesday.setHours(0, 0, 0, 0); | ||
|
||
const expectedActionItem = new ActionItem("Prepare the presentation", nextTuesday); | ||
const result = await new Functions().actionItems(goal); | ||
|
||
// Assuming the result is an array of ActionItems | ||
expect(result[0]).toEqual(expectedActionItem); | ||
}); | ||
}); | ||
}) | ||
// Assuming tanuki.align functionality is handled within the test itself | ||
it('create_action_items', async () => { | ||
const goal = "Can you please get the presentation to me by Wednesday?"; | ||
const nextWednesday = new Date(); | ||
nextWednesday.setDate(nextWednesday.getDate() + ((1 - nextWednesday.getDay() + 7) % 7)); | ||
nextWednesday.setHours(0, 0, 0, 0); | ||
|
||
const expectedActionItem = new ActionItem("Prepare the presentation", nextWednesday); | ||
const result = await new Functions().actionItems(goal); | ||
|
||
// Assuming the result is an array of ActionItems | ||
expect(result[0]).toEqual(expectedActionItem); | ||
}) | ||
}) |
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