1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-09 10:22:46 +03:00
Commit Graph

97 Commits

Author SHA1 Message Date
Travis Ralston
95c2c1643e Remove "source-map-support" from tests because it makes sourcemaps worse
Now that we're pointing at `src/` for tests, we can stop trying to load source maps from random places. With this dependency used, source maps are off by a few lines.
2019-12-17 15:45:15 -07:00
Travis Ralston
f952f6742f Remove ancient "use strict" annotations
We don't need these anymore. Theoretically this commit could go to develop, but for safety it's going to `travis/sourcemaps` first.
2019-12-17 15:43:02 -07:00
Travis Ralston
034b8db070 Convert tests to ES6
The earlier commit, d3ce0cb82f, has most of the juicy details on this. In addition to d3ce's changes, we also:
* Use `TestClient` in many integration tests due to subtle behaviour changes in imports when switching to ES6. Namely the behaviour where setting the request function is less reliable in the way we did it, but `TestClient` is very reliable.
* We now use the Olm loader more often to avoid having to maintain so much duplicate code. This makes the imports slightly easier to read.
2019-12-17 15:16:37 -07:00
Travis Ralston
5da936d96a Fix tests 2019-12-03 13:38:40 -07:00
Michael Telatynski
fd58957b06 migrate to jest from mocha+expect+istanbul
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2019-11-20 19:52:50 +00:00
Travis Ralston
a3c8eac38b Process ephemeral events outside timeline handling 2019-07-10 10:26:21 -06:00
J. Ryan Stinnett
761806c678 Add support for class properties
This enables compiler and linting features to allow class properties like we do
in the React SDK.
2019-05-13 13:52:37 +01:00
J. Ryan Stinnett
6ba7e85e24 Ensure we have crypto before accessing it in Room model
If crypto startup has failed, we shouldn't try to access any of its methods.
This fixes a variant of this in the `Room` model.
2019-04-04 12:06:41 +01:00
David Baker
a08a3078da Revert "room name should only take canonical alias into account" 2018-09-20 11:20:49 +01:00
Bruno Windels
574a6b68ae Merge pull request #735 from matrix-org/bwindels/fixstalerr
Introduce Room.myMembership event
2018-09-19 13:35:11 +02:00
Bruno Windels
fc3a00054f add test for new event 2018-09-17 19:33:36 +02:00
Bruno Windels
84e41c2ade fix tests 2018-09-17 18:28:07 +02:00
Bruno Windels
b829a39cd2 fix tests 2018-09-13 09:59:20 +02:00
David Baker
a0639a32c7 Revert "Revert "Don't rely on members to query if syncing user can post to room"" 2018-09-06 11:47:40 +01:00
David Baker
04ad3d7c3c Revert "Don't rely on members to query if syncing user can post to room" 2018-09-05 18:04:19 +01:00
Bruno Windels
8b00083bca check power levels without relying on membership
as this might not be known for the syncing user.
instead, add a method to room which always knows the syncing user's membership
2018-09-05 12:36:53 +02:00
Bruno Windels
768c66313f remove unneeded async keywords 2018-09-04 18:09:47 +02:00
Bruno Windels
a3567f0918 some tests for room.guessDMUserId() 2018-09-04 13:01:45 +02:00
David Baker
60c01d7869 Revert b0b0291 and a6de395
To make tests pass again
2018-08-30 12:03:53 +01:00
Matthew Hodgson
a6de395cde unbreak tests from b0b0291bc7 2018-08-28 18:03:59 +01:00
Bruno Windels
21e0c79f7d Revert "Revert "Lazy loading: don't block on setting up room crypto""
This reverts commit 5cf2ebea4f.
2018-08-27 10:54:08 +02:00
Bruno Windels
5cf2ebea4f Revert "Lazy loading: don't block on setting up room crypto" 2018-08-23 14:05:57 +02:00
Bruno Windels
e3d108454c fix test 2018-08-22 23:25:37 +02:00
Bruno Windels
482eab0e2a fix tests 2018-08-15 12:01:26 +02:00
Bruno Windels
07e87915ba fix and add tests 2018-08-15 12:01:26 +02:00
Bruno Windels
827db37eef fixup 2018-08-15 12:01:26 +02:00
Bruno Windels
864ea749e5 Move /members fetching to room as getEncryptionTargetMembers needs it 2018-08-15 12:01:26 +02:00
Bruno Windels
f261599435 fix lint 2018-08-15 12:00:38 +02:00
Bruno Windels
c0f706a2a2 move userId into room 2018-08-15 12:00:38 +02:00
Bruno Windels
cf08901d02 fix lint 2018-08-15 11:59:40 +02:00
Bruno Windels
230a9311a0 actually need to subtract one from join+invite count as that includes the syncing user 2018-08-15 11:59:40 +02:00
Bruno Windels
20b4285849 add some tests for room name based on room summary + fix because it was actually broken 2018-08-15 11:59:40 +02:00
Bruno Windels
f5ff5dc3e0 Fix name recalculation tests by not relying on mocking
I tried keeping the mocking but it would take too much
boilerplate code to make the tests work again, and even more
to write the tests for room name with lazy loading.

Just testing everything with a real implementation is not really
a unit test any more, but proved way easier.

It'll be somewhat annoying these tests will fail if there is
something wrong in roomstate (not room), but that's the trade-off
2018-08-15 11:59:40 +02:00
Bruno Windels
00bf5bdf69 unify member a bit access towards getMember
some tests for mock getMember, some for .members
if you use either in the code (as I did for room display name changes)
tests start playing and you play whack-a-mole switching between
both ways of accessing the members in a room.

lets start using one way so mocking becomes easier,
and besides, accessing an object internal members is not the best idea.
2018-08-15 11:59:40 +02:00
Bruno Windels
097e7df7c9 fix lint 2018-08-15 11:59:40 +02:00
Bruno Windels
5fcf9481b3 fix room not having access to event mapper + tests 2018-08-15 11:59:39 +02:00
Bruno Windels
48c3dcc08a fix lint & fix and add tests 2018-08-15 11:59:39 +02:00
Bruno Windels
df758b31b7 fix lint 2018-08-15 11:59:39 +02:00
Bruno Windels
9f08bfaa6f room lazy loading tests + fix 2018-08-15 11:59:39 +02: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
Matthew Hodgson
fb75134179 unbreak tests 2017-11-06 15:17:06 +00:00
David Baker
342f5c01e0 Update tests for new resetLiveTimeline interface 2017-07-19 14:54:18 +01: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
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
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
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
Kegan Dougal
7ed65407e6 Pass through eslint --fix 2017-01-13 10:49:32 +00:00
David Baker
e057956ede Add google eslint rules as a base
Remove some we don't care about. Set some other ones we do care
about but don't currently adhere to to warn. Set the max warnings
threshold to the current number of warnings, so we don't introduce
more of them. Fix a bunch of legit lint errors and add exceptions
to various places in the test code that does funny things with
'this'.
2017-01-12 14:35:58 +00:00
Matthew Hodgson
13c186dfbe fix lint 2016-09-08 15:29:53 +01:00