Skip to content

Commit

Permalink
Add batch test
Browse files Browse the repository at this point in the history
  • Loading branch information
somebee committed Mar 1, 2024
1 parent 19cc29f commit 19e573d
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions packages/imba/test/apps/observables/batch.imba
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import 'imba/spec'

let calls = 0
let runs = 0

class Base
@observable array = []

@computed get size
calls++
array.slice(0).length

@autorun def stuff
runs++
array.slice(0).length


test do
let base = new Base
base.size
imba.atomic do
for i in [0 ... 100]
base.array.push(10)
base.size
base.size

eq base.size, 100
ok calls == 2
eq runs, 2

SPEC.run!

0 comments on commit 19e573d

Please sign in to comment.