Skip to content

Commit

Permalink
Refactor a test to use map instead of for-loop
Browse files Browse the repository at this point in the history
Co-authored-by: Kræn Hansen <[email protected]>
  • Loading branch information
elle-j and kraenhansen committed Jun 12, 2024
1 parent 4abc2ae commit d67b258
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions integration-tests/tests/src/tests/counter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,16 @@ describe("Counter", () => {

it("can create and access (input: Counter)", function (this: RealmContext) {
const initialNumValues = initialValuesList;
const initialCounterValues: Counter[] = [];

// First create Realm objects with counters.
this.realm.write(() => {
for (const input of initialNumValues) {
const initialCounterValues = this.realm.write(() => {
return initialNumValues.map((input) => {
const { counter } = this.realm.create<IWithCounter>(WithCounterSchema.name, {
counter: input,
});
expectCounter(counter);
expect(counter.value).equals(input);

initialCounterValues.push(counter);
}
return counter;
});
});

// Use the managed Counters as input, each in a separate transaction.
Expand Down

0 comments on commit d67b258

Please sign in to comment.