Initial jest stuff. Blocked on Babel 7
This commit is contained in:
parent
b7fe06706d
commit
18f81d80db
19 changed files with 1144 additions and 77 deletions
|
@ -53,8 +53,7 @@
|
||||||
"stylelint": "stylelint 'res/css/**/*.scss'",
|
"stylelint": "stylelint 'res/css/**/*.scss'",
|
||||||
"clean": "rimraf lib",
|
"clean": "rimraf lib",
|
||||||
"prepare": "yarn clean && yarn build && git rev-parse HEAD > git-revision.txt",
|
"prepare": "yarn clean && yarn build && git rev-parse HEAD > git-revision.txt",
|
||||||
"test": "karma start --single-run=true --browsers VectorChromeHeadless",
|
"test": "jest --testMatch **/*-test.js",
|
||||||
"test-multi": "karma start",
|
|
||||||
"e2etests": "./test/end-to-end-tests/run.sh --riot-url http://localhost:8080"
|
"e2etests": "./test/end-to-end-tests/run.sh --riot-url http://localhost:8080"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -118,6 +117,7 @@
|
||||||
"babel-cli": "^6.26.0",
|
"babel-cli": "^6.26.0",
|
||||||
"babel-core": "^6.26.3",
|
"babel-core": "^6.26.3",
|
||||||
"babel-eslint": "^10.0.1",
|
"babel-eslint": "^10.0.1",
|
||||||
|
"babel-jest": "^23.6.0",
|
||||||
"babel-loader": "^7.1.5",
|
"babel-loader": "^7.1.5",
|
||||||
"babel-plugin-add-module-exports": "^0.2.1",
|
"babel-plugin-add-module-exports": "^0.2.1",
|
||||||
"babel-plugin-transform-builtin-extend": "^1.1.2",
|
"babel-plugin-transform-builtin-extend": "^1.1.2",
|
||||||
|
@ -142,7 +142,7 @@
|
||||||
"expect": "^24.1.0",
|
"expect": "^24.1.0",
|
||||||
"file-loader": "^3.0.1",
|
"file-loader": "^3.0.1",
|
||||||
"flow-parser": "^0.57.3",
|
"flow-parser": "^0.57.3",
|
||||||
"jest-mock": "^23.2.0",
|
"jest": "^23.2.0",
|
||||||
"karma": "^4.0.1",
|
"karma": "^4.0.1",
|
||||||
"karma-chrome-launcher": "^2.2.0",
|
"karma-chrome-launcher": "^2.2.0",
|
||||||
"karma-cli": "^1.0.1",
|
"karma-cli": "^1.0.1",
|
||||||
|
|
|
@ -61,8 +61,6 @@ describe('GroupView', function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
TestUtils.beforeEach(this);
|
|
||||||
|
|
||||||
httpBackend = new MockHttpBackend();
|
httpBackend = new MockHttpBackend();
|
||||||
|
|
||||||
Matrix.request(httpBackend.requestFn);
|
Matrix.request(httpBackend.requestFn);
|
||||||
|
|
|
@ -75,7 +75,6 @@ describe('MessagePanel', function() {
|
||||||
let sandbox = null;
|
let sandbox = null;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
test_utils.beforeEach(this);
|
|
||||||
sandbox = test_utils.stubClient();
|
sandbox = test_utils.stubClient();
|
||||||
client = MatrixClientPeg.get();
|
client = MatrixClientPeg.get();
|
||||||
client.credentials = {userId: '@me:here'};
|
client.credentials = {userId: '@me:here'};
|
||||||
|
|
|
@ -32,7 +32,6 @@ describe('Login', function() {
|
||||||
let parentDiv;
|
let parentDiv;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
TestUtils.beforeEach(this);
|
|
||||||
parentDiv = document.createElement('div');
|
parentDiv = document.createElement('div');
|
||||||
document.body.appendChild(parentDiv);
|
document.body.appendChild(parentDiv);
|
||||||
});
|
});
|
||||||
|
|
|
@ -32,7 +32,6 @@ describe('Registration', function() {
|
||||||
let parentDiv;
|
let parentDiv;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
TestUtils.beforeEach(this);
|
|
||||||
parentDiv = document.createElement('div');
|
parentDiv = document.createElement('div');
|
||||||
document.body.appendChild(parentDiv);
|
document.body.appendChild(parentDiv);
|
||||||
});
|
});
|
||||||
|
|
|
@ -36,7 +36,6 @@ describe('InteractiveAuthDialog', function() {
|
||||||
let sandbox;
|
let sandbox;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
test_utils.beforeEach(this);
|
|
||||||
sandbox = test_utils.stubClient(sandbox);
|
sandbox = test_utils.stubClient(sandbox);
|
||||||
parentDiv = document.createElement('div');
|
parentDiv = document.createElement('div');
|
||||||
document.body.appendChild(parentDiv);
|
document.body.appendChild(parentDiv);
|
||||||
|
|
|
@ -88,7 +88,6 @@ describe('MemberEventListSummary', function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(function(done) {
|
beforeEach(function(done) {
|
||||||
testUtils.beforeEach(this);
|
|
||||||
sandbox = testUtils.stubClient();
|
sandbox = testUtils.stubClient();
|
||||||
|
|
||||||
languageHandler.setLanguage('en').then(done);
|
languageHandler.setLanguage('en').then(done);
|
||||||
|
|
|
@ -70,8 +70,6 @@ describe("GroupMemberList", function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
TestUtils.beforeEach(this);
|
|
||||||
|
|
||||||
httpBackend = new MockHttpBackend();
|
httpBackend = new MockHttpBackend();
|
||||||
|
|
||||||
Matrix.request(httpBackend.requestFn);
|
Matrix.request(httpBackend.requestFn);
|
||||||
|
|
|
@ -38,7 +38,6 @@ describe('MemberList', () => {
|
||||||
let defaultUsers = [];
|
let defaultUsers = [];
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
TestUtils.beforeEach(this);
|
|
||||||
sandbox = TestUtils.stubClient(sandbox);
|
sandbox = TestUtils.stubClient(sandbox);
|
||||||
client = MatrixClientPeg.get();
|
client = MatrixClientPeg.get();
|
||||||
client.hasLazyLoadMembersEnabled = () => false;
|
client.hasLazyLoadMembersEnabled = () => false;
|
||||||
|
|
|
@ -29,7 +29,6 @@ xdescribe('MessageComposerInput', () => {
|
||||||
room = testUtils.mkStubRoom('!DdJkzRliezrwpNebLk:matrix.org');
|
room = testUtils.mkStubRoom('!DdJkzRliezrwpNebLk:matrix.org');
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
testUtils.beforeEach(this);
|
|
||||||
sandbox = testUtils.stubClient(sandbox);
|
sandbox = testUtils.stubClient(sandbox);
|
||||||
client = MatrixClientPeg.get();
|
client = MatrixClientPeg.get();
|
||||||
client.credentials = {userId: '@me:domain.com'};
|
client.credentials = {userId: '@me:domain.com'};
|
||||||
|
|
|
@ -45,7 +45,6 @@ describe('RoomList', () => {
|
||||||
let myOtherMember;
|
let myOtherMember;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
TestUtils.beforeEach(this);
|
|
||||||
sandbox = TestUtils.stubClient(sandbox);
|
sandbox = TestUtils.stubClient(sandbox);
|
||||||
client = MatrixClientPeg.get();
|
client = MatrixClientPeg.get();
|
||||||
client.credentials = {userId: myUserId};
|
client.credentials = {userId: myUserId};
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// beforeEach(function(done) {
|
// beforeEach(function(done) {
|
||||||
// testUtils.beforeEach(this);
|
|
||||||
// sandbox = testUtils.stubClient();
|
// sandbox = testUtils.stubClient();
|
||||||
// client = MatrixClientPeg.get();
|
// client = MatrixClientPeg.get();
|
||||||
// client.credentials = {userId: '@me:domain.com'};
|
// client.credentials = {userId: '@me:domain.com'};
|
||||||
|
|
|
@ -8,7 +8,6 @@ describe('languageHandler', function() {
|
||||||
let sandbox;
|
let sandbox;
|
||||||
|
|
||||||
beforeEach(function(done) {
|
beforeEach(function(done) {
|
||||||
testUtils.beforeEach(this);
|
|
||||||
sandbox = testUtils.stubClient();
|
sandbox = testUtils.stubClient();
|
||||||
|
|
||||||
languageHandler.setLanguage('en').then(done);
|
languageHandler.setLanguage('en').then(done);
|
||||||
|
|
|
@ -58,10 +58,6 @@ var USERNAME_RULE = {
|
||||||
|
|
||||||
|
|
||||||
describe("ContentRules", function() {
|
describe("ContentRules", function() {
|
||||||
beforeEach(function() {
|
|
||||||
test_utils.beforeEach(this);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("parseContentRules", function() {
|
describe("parseContentRules", function() {
|
||||||
it("should handle there being no keyword rules", function() {
|
it("should handle there being no keyword rules", function() {
|
||||||
var rules = { 'global': { 'content': [
|
var rules = { 'global': { 'content': [
|
||||||
|
|
|
@ -13,7 +13,6 @@ describe('RoomViewStore', function() {
|
||||||
let sandbox;
|
let sandbox;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
testUtils.beforeEach(this);
|
|
||||||
sandbox = testUtils.stubClient();
|
sandbox = testUtils.stubClient();
|
||||||
peg.get().credentials = { userId: "@test:example.com" };
|
peg.get().credentials = { userId: "@test:example.com" };
|
||||||
|
|
||||||
|
|
|
@ -11,26 +11,6 @@ import {ValidatedServerConfig} from "../src/utils/AutoDiscoveryUtils";
|
||||||
import ShallowRenderer from 'react-test-renderer/shallow';
|
import ShallowRenderer from 'react-test-renderer/shallow';
|
||||||
const MatrixEvent = jssdk.MatrixEvent;
|
const MatrixEvent = jssdk.MatrixEvent;
|
||||||
|
|
||||||
/**
|
|
||||||
* Perform common actions before each test case, e.g. printing the test case
|
|
||||||
* name to stdout.
|
|
||||||
* @param {Mocha.Context} context The test context
|
|
||||||
*/
|
|
||||||
export function beforeEach(context) {
|
|
||||||
const desc = context.currentTest.fullTitle();
|
|
||||||
|
|
||||||
console.log();
|
|
||||||
|
|
||||||
// this puts a mark in the chrome devtools timeline, which can help
|
|
||||||
// figure out what's been going on.
|
|
||||||
if (console.timeStamp) {
|
|
||||||
console.timeStamp(desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(desc);
|
|
||||||
console.log(new Array(1 + desc.length).join("="));
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getRenderer() {
|
export function getRenderer() {
|
||||||
// Old: ReactTestUtils.createRenderer();
|
// Old: ReactTestUtils.createRenderer();
|
||||||
return new ShallowRenderer();
|
return new ShallowRenderer();
|
||||||
|
|
|
@ -74,10 +74,6 @@ describe('MegolmExportEncryption', function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(function() {
|
|
||||||
testUtils.beforeEach(this);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('decrypt', function() {
|
describe('decrypt', function() {
|
||||||
it('should handle missing header', function() {
|
it('should handle missing header', function() {
|
||||||
const input=stringToArray(`-----`);
|
const input=stringToArray(`-----`);
|
||||||
|
|
|
@ -69,7 +69,6 @@ describe('Permalinks', function() {
|
||||||
let sandbox;
|
let sandbox;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
testUtils.beforeEach(this);
|
|
||||||
sandbox = testUtils.stubClient();
|
sandbox = testUtils.stubClient();
|
||||||
peg.get().credentials = { userId: "@test:example.com" };
|
peg.get().credentials = { userId: "@test:example.com" };
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue