Richard van der Hoff
547501ba81
Replace promise.inspect()
...
Bluebird promises don't have an `inspect()` method, but do have an
`isFulfilled()` and a `value()` method, so use them instead.
2017-07-12 23:33:55 +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
b58d84fba1
q.Promise -> Promise
...
```
find src spec -name '*.js' |
xargs perl -i -pe 's/q\.Promise/Promise/'
```
2017-07-12 23:32:28 +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
04b71c11e1
Merge pull request #492 from matrix-org/rav/even_more_flakey_tests
...
Fix some more flakey tests
2017-07-12 18:17:16 +01:00
Richard van der Hoff
651baefb1d
Remove redundant expectations
...
Apparently we weren't hitting these expected requests, so let's get rid of them.
2017-07-12 17:25:59 +01:00
Richard van der Hoff
ff7e845615
remove redundant flushAllExpected
...
Turned out this flush was completely redundant
2017-07-12 17:23:11 +01:00
Richard van der Hoff
f0612a1407
Fix some more flakey tests
...
switch a bunch of `flush()`es to `flushAllExpected()`s
2017-07-12 16:28:21 +01:00
Richard van der Hoff
83bd24adf8
More test deflakifying ( #491 )
...
Call `flushAllExpected()` from some more places. In a couple of places, we were
apparently calling `flush()` redundantly, so remove it altogether.
2017-07-12 14:05:39 +01:00
Richard van der Hoff
b5a8e6bbdf
Merge pull request #489 from t3chguy/t3chguy/test-crossplatform
...
make the npm test script windows-friendly
2017-07-12 13:49:43 +01:00
Michael Telatynski
9798fcf839
make the npm test script windows-friendly
2017-07-11 23:08:28 +01:00
David Baker
15556b6797
Merge pull request #488 from matrix-org/rav/deflakify_tests
...
Fix a bunch of races in the tests
2017-07-11 13:22:27 +01:00
Richard van der Hoff
0ca4d728d8
Fix a bunch of races in the tests
...
Once we switch to bluebird, suddenly a load of timing issues come out of the
woodwork. Basically, we need to try harder when flushing requests. Bump to
matrix-mock-request 1.1.0, which provides `flushAllExpected`, and waits for
requests to arrive when given a `numToFlush`; then use `flushAllExpected` in
various places to make the tests more resilient.
2017-07-11 12:09:21 +01:00
David Baker
b2c7804032
Merge pull request #487 from matrix-org/rav/fix_bad_all_usage
...
Fix early return in MatrixClient.setGuestAccess
2017-07-11 11:21:45 +01:00
David Baker
e091dc0294
Merge pull request #486 from matrix-org/rav/kill_failTest
...
Remove testUtils.failTest
2017-07-11 11:21:14 +01:00
Richard van der Hoff
3bfb4595cf
Remove redundant calls to done
...
These tests which return a promise already don't need to call `done`.
2017-07-10 17:40:23 +01:00
Richard van der Hoff
8955d8de23
remove utils.failTest
...
this is no longer used, so kill it
2017-07-10 17:25:56 +01:00
Richard van der Hoff
1372b298bb
kill off more utils.failTest refs
...
manual replacement of some more complicated utils.failTest usages with q.all()
invocations.
2017-07-10 17:25:48 +01:00
Richard van der Hoff
9558845e6e
Fix early return in MatrixClient.setGuestAccess
...
(as well as a similar bug in the test suite)
Turns out that `q.all(a, b)` === `q.all([a])`, rather than `q.all([a,b])`: it
only waits for the *first* promise - which means that `client.setGuestAccess`
would swallow any errors returned from the API.
2017-07-10 17:14:52 +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
David Baker
3294f4858a
Merge pull request #485 from matrix-org/rav/test_watch
...
Add test:watch script
2017-07-07 14:25:36 +01:00
Richard van der Hoff
eea9a3ba59
Add test:watch script
...
... to run the tests in a loop.
2017-07-07 14:19:41 +01:00
Richard van der Hoff
753974d663
Merge pull request #484 from matrix-org/rav/enable_async
...
Make it possible to use async/await
2017-07-07 13:47:59 +01:00
David Baker
527cd0a6e5
Implement 'joined_groups' API ( #477 )
...
* Add group summary api
* Add doc for group summary API
and remove callback param as it's deprecated
* API for /joined_groups
* Create group API
* Make doc marginally more helpful
2017-07-06 22:02:17 +01:00
Richard van der Hoff
24f70387d2
Make it possible to use async/await
...
Enables the babel plugin that transpiles async/await to generator functions,
and load the regenerator runtime so that generator functions work.
2017-07-06 18:52:37 +01:00
Richard van der Hoff
adc2070ac1
Merge pull request #483 from matrix-org/rav/remove_new_device_support
...
Remove m.new_device support
2017-07-06 17:10:37 +01:00
Richard van der Hoff
a8642682d0
Remove m.new_device support
...
We now rely on the server to track new devices, and tell us about them when
users add them, rather than forcing devices to announce themselves (see
https://github.com/vector-im/riot-web/issues/2305 for the whole backstory
there).
The necessary support for that has now been in all the clients and the server
for several months (since March or so). I now want to get rid of the
localstorage store, which this code is relying on, so now seems like a good
time to get rid of it. Yay.
2017-07-06 16:05:40 +01:00
Kegsay
d66e6db480
Merge pull request #478 from krombel/access_token_header
...
Use access-token in header
2017-07-06 13:44:31 +01:00
Krombel
dc66bbc3dc
pass useAuthorizationHeader from constructor; add docs
2017-07-06 13:47:54 +02:00
Krombel
6e7f5feea5
remove fallback to query-params and set Authorization-Header based on construcor-option
2017-07-05 17:04:40 +02:00
Richard van der Hoff
f21ea6c065
Extend timeout in megolm test
...
Use the default timeout of 100ms when waiting for the /send request, instead of
clamping it to 20ms.
2017-07-05 15:08:50 +01:00
Richard van der Hoff
6af56b56bc
Merge pull request #482 from matrix-org/rav/sanity_check_protocols
...
Sanity-check response from /thirdparty/protocols
2017-07-05 11:09:20 +01:00
Richard van der Hoff
598d40b0b7
Sanity-check response from /thirdparty/protocols
...
Check that /thirdparty/protocols gives us an object (rather than a string, for
instance). I saw a test explode, apparently because it gave us a string. Which
is odd, but in general we ought to be sanity-checking the things coming back
from the server.
2017-07-05 10:51:08 +01:00
Richard van der Hoff
6ae714f51f
Merge pull request #479 from matrix-org/rav/error_parsing
...
Avoid parsing plain-text errors as JSON
2017-07-04 17:11:47 +01:00
Richard van der Hoff
b0661bb586
Update to matrix-mock-request 1.0
...
-- to pick up on the json parsing differences
2017-07-04 16:35:33 +01:00
Richard van der Hoff
b6a165f1f8
Merge branch 'develop' into rav/error_parsing
2017-07-04 16:03:33 +01:00
Richard van der Hoff
8fe4a36b68
Merge pull request #481 from matrix-org/rav/use_external_mock_request
...
Use external mock-request
2017-07-04 16:01:21 +01:00
Richard van der Hoff
0d24f2d4c1
Use external mock-request
...
mock-request is now factored out to matrix-mock-request; use it
2017-07-04 15:45:22 +01:00
Krombel
dd0ff3eeb5
intercept first authedRequest to determine if accessToken can be send by header (clearer structure)
2017-07-04 16:16:10 +02:00
Krombel
07868f701a
Merge remote-tracking branch 'upstream/develop' into access_token_header
2017-07-04 15:28:17 +02:00
Richard van der Hoff
f4f0e4b60f
Merge pull request #480 from matrix-org/rav/fix_test_races
...
Fix some races in the tests
2017-07-04 14:04:24 +01:00
Richard van der Hoff
ae950a2ff4
Fix some races in the tests
...
There is a common pattern in the tests which is, when we want to mock a /sync,
to flush it, and then, in the next tick of the promise loop, to wait for the
syncing event. However, this is racy: there is no guarantee that the syncing
event will not happen before the next tick of the promise loop.
Instead, we should set the expectation of the syncing event, then do the flush.
(Technically we only need to wait for the syncing event, but by waiting for
both we'll catch any errors thrown by the flush, and make sure we don't have
any outstanding flushes before proceeding).
Add a utility method to TestClient to do the above, and use it where we have a
TestClient.
(Also fixes a couple of other minor buglets in the tests).
2017-07-04 13:48:26 +01:00
Richard van der Hoff
5f6e4bdfe9
Avoid parsing plain-text errors as JSON
...
It's somewhat unhelpful to spam over the actual error from the reverse-proxy or
whatever with a SyntaxError.
2017-07-03 19:30:23 +01:00
Krombel
c6d2d4ccda
readd failover if server does not handle access-token via header
2017-07-01 14:30:37 +02:00
Krombel
59160a5d42
Implement failover when server does not allow setting the Authorized-header (CORS)
2017-07-01 12:16:46 +02:00
Krombel
5da6423fd6
Added failover if server does not recognize the auth header
2017-06-27 13:29:08 +02:00
Krombel
d36b8721ca
Allow Authorization-Header in tests
2017-06-23 15:49:07 +02:00
Krombel
539abffe0e
Merge remote-tracking branch 'upstream/develop' into access_token_header
2017-06-23 15:16:58 +02:00
Krombel
9b24e66441
Merge branch 'develop' into access_token_header
2017-06-23 15:16:41 +02:00