Bruno Windels
1ce580bba3
test lazy loaded info is returned and then discarded when setting a state event
2018-08-15 11:59:39 +02:00
Bruno Windels
1c81a17298
Fix tests
...
getSentinelMember now does return a member (with just the userid) when there is no corresponding member yet.
With lazy loading it's perfectly possible the member is not available, and null breaks continuation in the timeline.
2018-08-15 11:59:39 +02:00
Hubert Chathi
d55618921b
initial implementation of e2e key backup and restore
2018-08-07 23:10:55 -04:00
Bruno Windels
e3e48944e0
add test
2018-07-27 11:49:55 +02:00
David Baker
16c062c069
Start first incremental sync request early ( #629 )
...
* Start first incremental sync request early
So it can run while we process our sync data.
2018-03-16 15:22:06 +00:00
David Baker
a0578efeb9
fix tests
2018-03-08 13:52:48 +00:00
David Baker
bdf6fcb222
Fix tests
2018-02-26 16:53:17 +00:00
David Baker
ec5cfe4ee9
Stop cloning events when adding to state
...
As comment hopefully explains.
On my test account:
Before: 394657 MatrixEvents, 53MB shallow size
After: 198863 MatrixEvents, 27MB shallow size
2018-02-20 16:45:20 +00:00
David Baker
8b649cec8d
All the copyrights
2018-01-18 11:52:27 +00:00
David Baker
27d28b8247
More test fixing
...
Allow localstorage store to take a localstorage impl, make TestClient
pass a cryptostore & fix True/true typo
2018-01-15 16:27:28 +00:00
David Baker
110f43a246
Make DeviceList test pass
...
Includes making saveIfDirty() return a promise in case you care
about when changes got saved (which the test does).
2018-01-15 15:21:39 +00:00
David Baker
e6dd573e8a
Fix test (needs a cryptostore now)
2017-12-06 19:42:01 +00:00
Matthew Hodgson
fb75134179
unbreak tests
2017-11-06 15:17:06 +00:00
Hubert Chathi
8f252992e4
keep track of event ID and timestamp of decrypted messages
...
This is to avoid false positives when detecting replay attacks.
fixes : vector-im/riot-web#3712
Signed-off-by: Hubert Chathi <hubert@uhoreg.ca >
2017-10-11 23:27:36 -04:00
Richard van der Hoff
f00558d840
Merge remote-tracking branch 'origin/develop' into rav/async_crypto/1
2017-08-15 18:31:02 +01:00
Richard van der Hoff
38c9a05a0c
Make Event.attemptDecryption return useful promises
...
Even if a decryption attempt is in progress, return a promise which blocks
until the attempt is complete.
2017-08-14 18:38:29 +01:00
Richard van der Hoff
8a0f73bf81
Make some OlmDevice megolm methods async
...
* OlmDevice.hasInboundSessionKeys
* OlmDevice.getInboundGroupSessionKey
The latter means that MegolmDecryption.shareKeysWithDevice takes longer before
it sends out the keyshare, so means the unit test needed an update
2017-08-10 15:01:56 +01:00
Richard van der Hoff
6613ee6b0d
Make crypto.decryptMessage return decryption results
...
... instead of having it call event.setClearData.
The main advantage of this is that it fixes a race condition, wherein apps
could see `event.isDecrypting()` to be true, but in fact the event had been
decrypted (and there was no `Event.decrypted` event on its way).
We're also fixing another race, wherein if the first attempt to decrypt failed,
a call to `attemptDecryption` would race against the first call and a second
attempt to decrypt would never happen.
This also gives a cleaner interface to MatrixEvent, at the expense of making
the `megolm` unit test a bit more hoop-jumpy.
2017-08-10 13:05:35 +01:00
Richard van der Hoff
906bf88450
Merge remote-tracking branch 'origin/develop' into rav/async_crypto/olmlib
2017-08-09 18:11:48 +01:00
Richard van der Hoff
aff32afefa
Make olmlib.encryptMessageForDevice async
2017-08-09 10:46:18 +01:00
Richard van der Hoff
18f75ec61c
make algorithm.hasKeysForKeyRequest async
2017-08-08 18:26:31 +01:00
Richard van der Hoff
8bbf14acbf
Let event decryption be asynchronous
...
Once everything moves to indexeddb, it's going to require callbacks and the
like, so let's make the decrypt API asynchronous in preparation.
2017-07-21 14:41:22 +01:00
David Baker
342f5c01e0
Update tests for new resetLiveTimeline interface
2017-07-19 14:54:18 +01:00
Richard van der Hoff
8b2fdf3a75
Deflake megolm unit test
...
Waiting for 1ms isn't actually good enough. wait for the actual thing we are
actually waiting for.
2017-07-14 15:22:08 +01:00
Richard van der Hoff
cfffbc4a09
replace q method calls with bluebird ones
...
```
find src spec -name '*.js' |
xargs perl -i -pe 's/q\.(all|defer|reject|delay|try)\(/Promise.$1(/'
```
2017-07-12 23:33:55 +01:00
Richard van der Hoff
a5d3dd942e
q(...) -> Promise.resolve
...
```
find src spec -name '*.js' |
xargs perl -i -pe 's/\bq(\([^(]*\))/Promise.resolve$1/'
```
2017-07-12 23:32:28 +01:00
Richard van der Hoff
b96062b6de
replace imports of q
with bluebird
...
```
find src spec -name '*.js' |
xargs perl -i -pe 'if (/require\(.q.\)/) { $_ = "import Promise from '\''bluebird'\'';\n"; }'
find src spec -name '*.js' |
xargs perl -i -pe 'if (/import q/) { $_ = "import Promise from '\''bluebird'\'';\n"; }'
```
2017-07-12 23:32:28 +01:00
Richard van der Hoff
5ab0930de8
utils.failTest -> nodeify
...
Automated replacement of utils.failTest with nodeify
This was done with the perl incantation:
```
find spec -name '*.js' |
xargs perl -i -pe 's/catch\((testUtils|utils).failTest\).done\(done\)/nodeify(done)/'
```
more auto
2017-07-10 16:37:31 +01:00
Richard van der Hoff
1f86dbd12f
Add support for forwarding room keys to megolm
...
when we receive a m.forwarded_room_key, add it to the crypto store, but
remember who forwarded it to us, so we can decide whether to trust them
separately.
2017-06-20 12:39:36 +01:00
Richard van der Hoff
be3fb0f917
Make a start on a unit test for megolm alg impl
...
not much here yet, but it's a start at least.
2017-06-20 11:51:30 +01:00
Richard van der Hoff
655be2fa2e
Fix race in device list updates
...
Don't consider device lists up-to-date when we have another request for the
relevant user in the queue.
Fixes https://github.com/vector-im/riot-web/issues/3796 .
2017-05-05 12:34:00 +01:00
David Baker
bf6490739d
Fix tests
...
Make setSyncData return promises in a few places and fix all the
places the tests assume that /sync being flushed == the sync
result being processed.
2017-04-06 15:20:50 +01:00
David Baker
b72b38b0a3
Add missed methods to stub/memory store
...
and fix tests
2017-04-03 17:45:58 +01:00
Kegan Dougal
c30670000d
Handle 'limited' timeline responses in the SyncAccumulator
...
Fixes vector-im/riot-web#3375
2017-03-16 13:20:27 +00:00
David Baker
08a3aea1c7
Fix tests
2017-02-28 13:44:44 +00:00
Kegan Dougal
36b8b2c679
Unbreak tests. Add UT for account data
2017-02-21 11:51:45 +00:00
Kegan Dougal
5aa146f0a6
Add function to UTs
2017-02-17 10:41:04 +00:00
Kegan Dougal
c93c8a79b7
Add startup() to store API
2017-02-17 10:14:12 +00:00
Kegan Dougal
9a9646d012
Review comments
2017-02-16 11:28:51 +00:00
Kegan Dougal
9fdeb7a8e3
Add tests for the SyncAccumulator
2017-02-15 16:21:06 +00:00
Kegan Dougal
cc1daa5a54
Fix tests due to API breakage
2017-02-09 17:32:23 +00:00
Richard van der Hoff
bd226d94d8
Switch from jasmine to mocha + expect + lolex
...
Much of this transformation has been done automatically:
* add expect import to each file
* replace `not.to` with `toNot`
* replace `to[Not]Be{Undefined,Null}` with equivalents
* replace `jasmine.createSpy(...)` with `except.createSpy`, and `andCallFake`
with `andCall`
Also:
* replace `jasmine.createSpyObj` with manual alternatives
* replace `jasmine.Clock` with `lolex`
2017-02-08 14:32:37 +00:00
Richard van der Hoff
8a487ca1bc
Merge branch 'rav/source_map_support' into develop
2017-02-08 11:35:27 +00:00
Richard van der Hoff
80d0aadbd0
Install source-map-support in each test
...
This makes exception traces use the source map, which is much more helpful when
debugging.
2017-02-07 22:57:09 +00:00
Richard van der Hoff
d744cecbfa
Make the tests work without olm
...
Olm is an optional dependency, so the tests should work without it.
2017-02-07 22:56:56 +00:00
David Baker
423175f539
eslint --fix for dangley commas on function calls
2017-01-20 16:12:02 +00:00
David Baker
7bca05af64
eslint ---fix for prefer-const
2017-01-19 17:42:10 +00:00
Kegan Dougal
317898d41c
Fix linting on all tests
...
Manually.
2017-01-16 10:28:51 +00:00
Kegan Dougal
cc39ede920
Reduce max warnings and fix lint errors
2017-01-13 14:36:48 +00:00
Kegan Dougal
5abf6b9f20
Manually patch up files which were formatted wrong
...
`eslint --fix` expands `if` statements incorrectly (wrong indentation).
2017-01-13 11:50:00 +00:00