Vaguely working webpack test

This commit is contained in:
Richard van der Hoff 2016-03-28 17:36:22 +01:00
parent f60dd93660
commit d7801ef3a4
4 changed files with 81 additions and 18 deletions

View file

@ -0,0 +1,22 @@
var React = require('react');
var TestUtils = require('react-addons-test-utils');
var expect = require('expect');
var sdk = require('matrix-react-sdk');
var MatrixChat;
describe('MatrixChat', function () {
before(function() {
MatrixChat = sdk.getComponent('structures.MatrixChat');
});
it('gives a login panel by default', function () {
var res = TestUtils.renderIntoDocument(
<MatrixChat config={{}}/>
);
// we expect a single <Login> component
TestUtils.findRenderedComponentWithType(
res, sdk.getComponent('structures.login.Login'));
});
});

11
test/tests.js Normal file
View file

@ -0,0 +1,11 @@
// tests.js
//
// Our master test file: uses the webpack require API to find our test files
// and run them
// this is a handly place to make sure the sdk has been skinned
var sdk = require("matrix-react-sdk");
sdk.loadSkin(require('test-component-index'));
var context = require.context('.', true, /-test\.jsx?$/);
context.keys().forEach(context);