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

@@ -4,6 +4,8 @@ const sdk = require("../..");
const HttpBackend = require("../mock-request");
const utils = require("../test-utils");
import expect from 'expect';
describe("MatrixClient events", function() {
const baseUrl = "http://localhost.or.something";
let client;
@@ -142,8 +144,8 @@ describe("MatrixClient events", function() {
let fired = false;
client.on("User.presence", function(event, user) {
fired = true;
expect(user).toBeDefined();
expect(event).toBeDefined();
expect(user).toBeTruthy();
expect(event).toBeTruthy();
if (!user || !event) {
return;
}
@@ -208,7 +210,7 @@ describe("MatrixClient events", function() {
client.on("RoomState.events", function(event, state) {
eventsInvokeCount++;
const index = roomStateEventTypes.indexOf(event.getType());
expect(index).not.toEqual(
expect(index).toNotEqual(
-1, "Unexpected room state event type: " + event.getType(),
);
if (index >= 0) {