element-web-Github/test/components/structures/MatrixChat-test.js

35 lines
919 B
JavaScript
Raw Normal View History

2016-03-29 00:36:22 +08:00
var React = require('react');
var TestUtils = require('react-addons-test-utils');
var expect = require('expect');
var sdk = require('matrix-react-sdk');
var MatrixChat = sdk.getComponent('structures.MatrixChat');
var peg = require('../../../src/MatrixClientPeg');
2016-03-29 05:59:34 +08:00
var test_utils = require('../../test-utils');
var q = require('q');
2016-03-29 00:36:22 +08:00
describe('MatrixChat', function () {
var sandbox;
beforeEach(function() {
sandbox = test_utils.stubClient();
});
afterEach(function() {
sandbox.restore();
2016-03-29 00:36:22 +08:00
});
it('gives a login panel by default', function () {
2016-03-29 07:02:48 +08:00
peg.get().loginFlows.returns(q({flows:[]}));
2016-03-29 05:59:34 +08:00
2016-03-29 00:36:22 +08:00
var res = TestUtils.renderIntoDocument(
<MatrixChat config={{}}/>
);
// we expect a single <Login> component
TestUtils.findRenderedComponentWithType(
res, sdk.getComponent('structures.login.Login'));
});
});