Tests: delete indexeddbs after running

This commit is contained in:
Richard van der Hoff 2017-06-14 17:08:49 +01:00
parent 59da904353
commit 5ff59b0c23
2 changed files with 40 additions and 6 deletions

View file

@ -30,7 +30,7 @@ import sdk from 'matrix-react-sdk';
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
import * as languageHandler from 'matrix-react-sdk/lib/languageHandler';
import test_utils from '../test-utils';
import * as test_utils from '../test-utils';
import MockHttpBackend from '../mock-request';
import {parseQs, parseQsFromFragment} from '../../src/vector/url_utils';
@ -68,12 +68,19 @@ describe('loading:', function () {
});
});
afterEach(function() {
afterEach(async function() {
if (parentDiv) {
ReactDOM.unmountComponentAtNode(parentDiv);
parentDiv.remove();
parentDiv = null;
}
// unmounting should have cleared the MatrixClientPeg
expect(MatrixClientPeg.get()).toBe(null);
// clear the indexeddbs so we can start from a clean slate next time.
await test_utils.deleteIndexedDB('matrix-js-sdk:crypto');
await test_utils.deleteIndexedDB('matrix-js-sdk:riot-web-sync');
});
/* simulate the load process done by index.js