Skip to content

Commit

Permalink
add test to validate that foreach throws on a dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Gunnarsson committed Feb 22, 2023
1 parent 8193f13 commit fe19e4e
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 @@ -120,6 +120,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 fe19e4e

Please sign in to comment.