Fix tests

* Serve translation files from the karma server
 * Port UserSettingsStore to ES6 exports because the test runner
   gets confused by ES6 importing a commonjs module
 * Remove extra spaces in translations strings for MELS
 * Fix 'his/her' back to be 'their'
 * Change test to expect singular 'invitation' for a single person
   (there may be multiple invitations, but IMO this should be
   'rejected n invitations' and we can play with the wording later,
   I don't think the singular is any worse than the plural).
 * set language in the MELS tests (and wait for it to complete)
 * Don't bother setting lang in other tests for now
This commit is contained in:
David Baker 2017-05-26 11:58:45 +01:00
parent dfc8cf3f54
commit e44f3cc709
8 changed files with 146 additions and 143 deletions

View file

@ -4,6 +4,7 @@ const ReactDOM = require("react-dom");
const ReactTestUtils = require('react-addons-test-utils');
const sdk = require('matrix-react-sdk');
const MemberEventListSummary = sdk.getComponent('views.elements.MemberEventListSummary');
import * as languageHandler from '../../../../src/languageHandler';
const testUtils = require('../../../test-utils');
describe('MemberEventListSummary', function() {
@ -82,9 +83,11 @@ describe('MemberEventListSummary', function() {
return eventsForUsers;
};
beforeEach(function() {
beforeEach(function(done) {
testUtils.beforeEach(this);
sandbox = testUtils.stubClient();
languageHandler.setLanguage('en').done(done);
});
afterEach(function() {
@ -356,7 +359,7 @@ describe('MemberEventListSummary', function() {
const summaryText = summary.innerText;
expect(summaryText).toBe(
"user_1 and 1 other were unbanned, joined and left 2 times and were banned"
"user_1 and one other were unbanned, joined and left 2 times and were banned"
);
});
@ -559,7 +562,7 @@ describe('MemberEventListSummary', function() {
const summaryText = summary.innerText;
expect(summaryText).toBe(
"user_1 and 1 other rejected their invitations and " +
"user_1 and one other rejected their invitations and " +
"had their invitations withdrawn"
);
});
@ -595,7 +598,7 @@ describe('MemberEventListSummary', function() {
const summaryText = summary.innerText;
expect(summaryText).toBe(
"user_1 rejected their invitations 2 times"
"user_1 rejected their invitation 2 times"
);
});
@ -650,7 +653,7 @@ describe('MemberEventListSummary', function() {
const summaryText = summary.innerText;
expect(summaryText).toBe(
"user_1, user_2 and 1 other joined"
"user_1, user_2 and one other joined"
);
});