Initial jest stuff. Blocked on Babel 7

pull/21833/head
Michael Telatynski 2019-12-13 13:43:48 +00:00
parent b7fe06706d
commit 18f81d80db
19 changed files with 1144 additions and 77 deletions

View File

@ -53,8 +53,7 @@
"stylelint": "stylelint 'res/css/**/*.scss'",
"clean": "rimraf lib",
"prepare": "yarn clean && yarn build && git rev-parse HEAD > git-revision.txt",
"test": "karma start --single-run=true --browsers VectorChromeHeadless",
"test-multi": "karma start",
"test": "jest --testMatch **/*-test.js",
"e2etests": "./test/end-to-end-tests/run.sh --riot-url http://localhost:8080"
},
"dependencies": {
@ -118,6 +117,7 @@
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"babel-loader": "^7.1.5",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-builtin-extend": "^1.1.2",
@ -142,7 +142,7 @@
"expect": "^24.1.0",
"file-loader": "^3.0.1",
"flow-parser": "^0.57.3",
"jest-mock": "^23.2.0",
"jest": "^23.2.0",
"karma": "^4.0.1",
"karma-chrome-launcher": "^2.2.0",
"karma-cli": "^1.0.1",

View File

@ -61,8 +61,6 @@ describe('GroupView', function() {
};
beforeEach(function() {
TestUtils.beforeEach(this);
httpBackend = new MockHttpBackend();
Matrix.request(httpBackend.requestFn);

View File

@ -75,7 +75,6 @@ describe('MessagePanel', function() {
let sandbox = null;
beforeEach(function() {
test_utils.beforeEach(this);
sandbox = test_utils.stubClient();
client = MatrixClientPeg.get();
client.credentials = {userId: '@me:here'};

View File

@ -32,7 +32,6 @@ describe('Login', function() {
let parentDiv;
beforeEach(function() {
TestUtils.beforeEach(this);
parentDiv = document.createElement('div');
document.body.appendChild(parentDiv);
});

View File

@ -32,7 +32,6 @@ describe('Registration', function() {
let parentDiv;
beforeEach(function() {
TestUtils.beforeEach(this);
parentDiv = document.createElement('div');
document.body.appendChild(parentDiv);
});

View File

@ -36,7 +36,6 @@ describe('InteractiveAuthDialog', function() {
let sandbox;
beforeEach(function() {
test_utils.beforeEach(this);
sandbox = test_utils.stubClient(sandbox);
parentDiv = document.createElement('div');
document.body.appendChild(parentDiv);

View File

@ -88,7 +88,6 @@ describe('MemberEventListSummary', function() {
};
beforeEach(function(done) {
testUtils.beforeEach(this);
sandbox = testUtils.stubClient();
languageHandler.setLanguage('en').then(done);

View File

@ -70,8 +70,6 @@ describe("GroupMemberList", function() {
};
beforeEach(function() {
TestUtils.beforeEach(this);
httpBackend = new MockHttpBackend();
Matrix.request(httpBackend.requestFn);

View File

@ -38,7 +38,6 @@ describe('MemberList', () => {
let defaultUsers = [];
beforeEach(function() {
TestUtils.beforeEach(this);
sandbox = TestUtils.stubClient(sandbox);
client = MatrixClientPeg.get();
client.hasLazyLoadMembersEnabled = () => false;

View File

@ -29,7 +29,6 @@ xdescribe('MessageComposerInput', () => {
room = testUtils.mkStubRoom('!DdJkzRliezrwpNebLk:matrix.org');
beforeEach(function() {
testUtils.beforeEach(this);
sandbox = testUtils.stubClient(sandbox);
client = MatrixClientPeg.get();
client.credentials = {userId: '@me:domain.com'};

View File

@ -45,7 +45,6 @@ describe('RoomList', () => {
let myOtherMember;
beforeEach(function() {
TestUtils.beforeEach(this);
sandbox = TestUtils.stubClient(sandbox);
client = MatrixClientPeg.get();
client.credentials = {userId: myUserId};

View File

@ -36,7 +36,6 @@
// }
//
// beforeEach(function(done) {
// testUtils.beforeEach(this);
// sandbox = testUtils.stubClient();
// client = MatrixClientPeg.get();
// client.credentials = {userId: '@me:domain.com'};

View File

@ -8,7 +8,6 @@ describe('languageHandler', function() {
let sandbox;
beforeEach(function(done) {
testUtils.beforeEach(this);
sandbox = testUtils.stubClient();
languageHandler.setLanguage('en').then(done);

View File

@ -58,10 +58,6 @@ var USERNAME_RULE = {
describe("ContentRules", function() {
beforeEach(function() {
test_utils.beforeEach(this);
});
describe("parseContentRules", function() {
it("should handle there being no keyword rules", function() {
var rules = { 'global': { 'content': [

View File

@ -13,7 +13,6 @@ describe('RoomViewStore', function() {
let sandbox;
beforeEach(function() {
testUtils.beforeEach(this);
sandbox = testUtils.stubClient();
peg.get().credentials = { userId: "@test:example.com" };

View File

@ -11,26 +11,6 @@ import {ValidatedServerConfig} from "../src/utils/AutoDiscoveryUtils";
import ShallowRenderer from 'react-test-renderer/shallow';
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() {
// Old: ReactTestUtils.createRenderer();
return new ShallowRenderer();

View File

@ -74,10 +74,6 @@ describe('MegolmExportEncryption', function() {
}
});
beforeEach(function() {
testUtils.beforeEach(this);
});
describe('decrypt', function() {
it('should handle missing header', function() {
const input=stringToArray(`-----`);

View File

@ -69,7 +69,6 @@ describe('Permalinks', function() {
let sandbox;
beforeEach(function() {
testUtils.beforeEach(this);
sandbox = testUtils.stubClient();
peg.get().credentials = { userId: "@test:example.com" };
});

1171
yarn.lock

File diff suppressed because it is too large Load Diff