Skip to content

Commit

Permalink
Add tests to handle non validated schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
tgandrews committed Mar 2, 2023
1 parent 86d8c48 commit a25bc54
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/index.test.ts
Expand Up @@ -367,6 +367,30 @@ describe("omanyd", () => {
new Date("2023-03-02T11:49:00.000Z")
);
});

it("should save and return arrays with no schema", async () => {
interface Thing {
id: string;
list: number[];
}
const ThingStore = Omanyd.define<Thing>({
name: "arraysOfNumbers",
hashKey: "id",
schema: Joi.object({
id: Omanyd.types.id(),
list: Joi.array().required(),
}),
});

await Omanyd.createTables();

const savedThing = await ThingStore.create({
list: [123, 456, 789],
});
const readThing = await ThingStore.getByHashKey(savedThing.id);
expect(savedThing.list).toStrictEqual([123, 456, 789]);
expect(readThing?.list).toStrictEqual([123, 456, 789]);
});
});

describe("range key", () => {
Expand Down

0 comments on commit a25bc54

Please sign in to comment.