git ssb

0+

Dominic / ssb-peer-invites



Commit 6868da9f177810f436109565b2ebf80b78fe44da

update tests to assume just one argument

Dominic Tarr committed on 7/5/2019, 11:04:12 AM
Parent: cb6fe8cf24dfda94e22f981ad9074b4edae061df

Files changed

test/accept2.jschanged
test/accept3.jschanged
test/accept4.jschanged
test/accept5.jschanged
test/invite-with-pubs.jschanged
test/accept2.jsView
@@ -51,13 +51,15 @@
5151
5252 //use device address, just for tests
5353 invite.pubs.push(alice.getAddress('device'))
5454
55- bob.peerInvites.openInvite(invite, function (err, invite_msg, data) {
55 + bob.peerInvites.openInvite(invite, function (err, data) {
5656 if(err) throw err
57 + var invite_msg = data.value
58 + var opened = data.opened
5759 t.ok(invite)
5860 t.equal(toId(invite_msg), invite_id)
59- t.deepEqual(data, {reveal: undefined, private: undefined})
61 + t.deepEqual(opened, {reveal: undefined, private: undefined})
6062 //check this invite is valid. would throw if it wasn't.
6163 bob.peerInvites.acceptInvite(invite, function (err, confirm) {
6264 if(err) throw err
6365
@@ -74,5 +76,4 @@
7476 })
7577 })
7678 })
7779 })
78-
test/accept3.jsView
@@ -54,14 +54,16 @@
5454
5555 //use device address, just for tests
5656 invite.pubs.push(alice.getAddress('device'))
5757
58- bob.peerInvites.openInvite(invite, function (err, invite_msg, data) {
58 + bob.peerInvites.openInvite(invite, function (err, data) {
5959 if(err) throw err
60 + var invite_msg = data.value
61 + var opened = data.opened
6062 t.ok(invite)
6163 t.equal(invite_msg.author, carol_id)
6264 t.equal(toId(invite_msg), invite_id)
63- t.deepEqual(data, {reveal: undefined, private: undefined})
65 + t.deepEqual(opened, {reveal: undefined, private: undefined})
6466 //check this invite is valid. would throw if it wasn't.
6567 bob.peerInvites.acceptInvite(invite, function (err, confirm) {
6668 if(err) throw err
6769 t.equal(confirm.author, alice.id)
@@ -81,5 +83,4 @@
8183 })
8284 })
8385 })
8486 })
85-
test/accept4.jsView
@@ -50,13 +50,15 @@
5050
5151 //use device address, just for tests
5252 invite.pubs.push(alice.getAddress('device'))
5353
54- bob.peerInvites.openInvite(u.stringify(invite), function (err, invite_msg, data) {
54 + bob.peerInvites.openInvite(u.stringify(invite), function (err, data) {
5555 if(err) throw err
56 + var invite_msg = data.value
57 + var opened = data.opened
5658 t.ok(invite)
5759 t.equal(toId(invite_msg), invite_id)
58- t.deepEqual(data, {reveal: undefined, private: undefined})
60 + t.deepEqual(opened, {reveal: undefined, private: undefined})
5961
6062 //bob publishes accept_content manually. simulates that he crashed
6163 //before causing confirm.
6264 var accept_content = I.createAccept(invite_msg, seed, bob.id, caps)
@@ -82,8 +84,4 @@
8284 })
8385 })
8486 })
8587 })
86-
87-
88-
89-
test/accept5.jsView
@@ -49,14 +49,16 @@
4949 var invite_id = invite.invite
5050
5151 //use device address, just for tests
5252 invite.pubs.push(alice.getAddress('device'))
53 + t.ok(invite)
5354
54- bob.peerInvites.openInvite(u.stringify(invite), function (err, invite_msg, data) {
55 + bob.peerInvites.openInvite(u.stringify(invite), function (err, data) {
5556 if(err) throw err
56- t.ok(invite)
57 + var invite_msg = data.value
58 + var opened = data.opened
5759 t.equal(toId(invite_msg), invite_id)
58- t.deepEqual(data, {reveal: undefined, private: undefined})
60 + t.deepEqual(opened, {reveal: undefined, private: undefined})
5961
6062 //bob publishes accept_content manually. simulates that he crashed
6163 //before causing confirm.
6264 var accept_content = I.createAccept(invite_msg, seed, bob.id, caps)
@@ -91,5 +93,4 @@
9193 })
9294 })
9395 })
9496 })
95-
test/invite-with-pubs.jsView
@@ -112,11 +112,11 @@
112112 alice.get(invite.invite, function (err, invite_msg) {
113113 if(err) throw err
114114 t.deepEqual(invite.pubs, [carol.getAddress('device')])
115115
116- bob.peerInvites.openInvite(invite, function (err, _invite_msg) {
116 + bob.peerInvites.openInvite(invite, function (err, data) {
117117 if(err) throw explain(err, 'error while opening invite')
118- t.deepEqual(_invite_msg, invite_msg)
118 + t.deepEqual(data.value, invite_msg)
119119 bob.peerInvites.acceptInvite(invite, function (err) {
120120 if(err) throw err
121121 t.end()
122122 })
@@ -135,7 +135,4 @@
135135 bob.close()
136136 t.end()
137137 }, 1000)
138138 })
139-
140-
141-

Built with git-ssb-web