-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
#231 is in the trash, but it had one part I really liked, and can't believe we didn't do before: pure functions that take in a chunk of schema and assert on the generated code!
oxide.ts/generator/client/api.test.ts
Lines 68 to 81 in ace6464
| describe("generateTransformFunction", () => { | |
| it("handles timestamps at top level", () => { | |
| expect(genTransformResponse(projectSchema)).toMatchInlineSnapshot(` | |
| "(o) => { | |
| o.time_created = new Date(o.time_created) | |
| o.time_modified = new Date(o.time_modified) | |
| }" | |
| `); | |
| }); | |
| it("returns null when there are no transforms to make", () => { | |
| expect(genTransformResponse(noTransforms)).toEqual(undefined); | |
| }); | |
| }); |
I also learned about these libraries that could give more structure to our very stringy generation code:
Metadata
Metadata
Assignees
Labels
No labels