forked from youiest/youiest-unionize
-
Notifications
You must be signed in to change notification settings - Fork 1
/
testsInbox.coffee
40 lines (28 loc) · 1.29 KB
/
testsInbox.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# rule: no updates in W, only inserts. Unless it's a hook or cronjob, and we meaure it's speed
#
# test that findOne (natural:-1) finds latest version insert and learn how responsive it is
#a = do -> eval('arguments.callee.caller.toString().match(/(unionize.{20}.*?)/)')[0]
# test that hook writes to .inbox of .to in WI
if Meteor.isClient
#Meteor.call 'dummyInsert'
@recFrom = 'picture'
recommendation =
to: user
from: recFrom
Tinytest.addAsync 'update - from client outbox to client inbox', (test, next) ->
# update outbox serverside with minimal information.
connect(recommendation)
#when client update synced to server, hook inserts w and w is synced to client tracker reruns
inbox = Tracker.autorun (computation) ->
# since the sync hasn't gone to server and back (hooks!) we test once the data is here
unless !W.findOne({to:user})
test.equal recFrom , W.findOne({to:user}).from
next()
# computation.stop() # APPEARS not necessary
return
return
return
# test that grounddb syncs back offline changes
# test that grounddb changes synced back to server trigger hooks
# test that hooks follow rules and only maintain enough data on WI objects to load fresh data
# test that I have a sane WI waiting for me when I log in