Skip to content

Commit

Permalink
add test to validate that foreach throws on a dictionary (#5467)
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobOscarGunnarsson authored and kraenhansen committed Mar 3, 2023
1 parent 2568674 commit 9a1f799
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions integration-tests/tests/src/tests/dictionary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,14 @@ describe("Dictionary", () => {
});
}

it("iterating with forEach() throws", function (this: RealmContext) {
const item = this.realm.write(() => {
return this.realm.create<Item>("Item", {});
});
//@ts-expect-error accesses forEach on a dictionary which should not exist.
expect(() => item.dict.forEach()).throws(TypeError, "item.dict.forEach is not a function");
});

it("can store string values using string keys", function (this: RealmContext) {
const item = this.realm.write(() => {
const item = this.realm.create<Item>("Item", {});
Expand Down

0 comments on commit 9a1f799

Please sign in to comment.