1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2026-01-03 23:22:30 +03:00

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`
This commit is contained in:
Richard van der Hoff
2017-02-08 07:29:01 +00:00
parent 8a487ca1bc
commit bd226d94d8
28 changed files with 252 additions and 183 deletions

View File

@@ -95,7 +95,6 @@ function startClient(httpBackend, client) {
return deferred.promise;
}
describe("getEventTimeline support", function() {
let httpBackend;
let client;
@@ -143,7 +142,7 @@ describe("getEventTimeline support", function() {
const timelineSet = room.getTimelineSets()[0];
expect(function() {
client.getEventTimeline(timelineSet, "event");
}).not.toThrow();
}).toNotThrow();
}).catch(utils.failTest).done(done);
httpBackend.flush().catch(utils.failTest);
@@ -220,6 +219,8 @@ describe("getEventTimeline support", function() {
});
});
import expect from 'expect';
describe("MatrixClient event timelines", function() {
let client = null;
let httpBackend = null;
@@ -311,7 +312,7 @@ describe("MatrixClient event timelines", function() {
httpBackend.flush().catch(utils.failTest);
});
it("should update timelines where they overlap a previous /sync", function(done) {
it("should update timelines where they overlap a previous /sync", function() {
const room = client.getRoom(roomId);
const timelineSet = room.getTimelineSets()[0];
httpBackend.when("GET", "/sync").respond(200, {
@@ -343,6 +344,7 @@ describe("MatrixClient event timelines", function() {
};
});
const deferred = q.defer();
client.on("sync", function() {
client.getEventTimeline(timelineSet, EVENTS[2].event_id,
).then(function(tl) {
@@ -354,10 +356,14 @@ describe("MatrixClient event timelines", function() {
.toEqual("start_token");
// expect(tl.getPaginationToken(EventTimeline.FORWARDS))
// .toEqual("s_5_4");
}).catch(utils.failTest).done(done);
}).done(() => deferred.resolve(),
(e) => deferred.reject(e));
});
httpBackend.flush().catch(utils.failTest);
return q.all([
httpBackend.flush(),
deferred.promise,
]);
});
it("should join timelines where they overlap a previous /context",