Skip to content

Commit e37da08

Browse files
committed
Replace beforeEach with just a cleanLocalstorage call
The rest isn't needed anymore.
1 parent 3c9c0ec commit e37da08

2 files changed

Lines changed: 3 additions & 24 deletions

File tree

‎test/app-tests/loading-test.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {makeType} from "matrix-react-sdk/src/utils/TypeUtils";
3737
import {ValidatedServerConfig} from "matrix-react-sdk/src/utils/AutoDiscoveryUtils";
3838
import {sleep} from "../test-utils";
3939
import "fake-indexeddb/auto";
40+
import {cleanLocalstorage} from "../test-utils";
4041

4142
const DEFAULT_HS_URL='http://my_server';
4243
const DEFAULT_IS_URL='http://my_is';
@@ -86,6 +87,7 @@ describe('loading:', function() {
8687
test_utils.deleteIndexedDB('matrix-js-sdk:crypto'),
8788
test_utils.deleteIndexedDB('matrix-js-sdk:riot-web-sync'),
8889
]);
90+
cleanLocalstorage();
8991
console.log(`${Date.now()}: loading: afterEach complete`);
9092
});
9193

‎test/test-utils.js‎

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,7 @@
1-
"use strict";
2-
3-
/**
4-
* Perform common actions before each test case, e.g. printing the test case
5-
* name to stdout.
6-
* @param {Mocha.Context} context The test context
7-
*/
8-
export function beforeEach(context) {
9-
const desc = context.currentTest.fullTitle();
10-
console.log();
11-
console.log(desc);
12-
console.log(new Array(1 + desc.length).join("="));
13-
14-
// some tests store things in localstorage. Improve independence of tests
15-
// by making sure that they don't inherit any old state.
1+
export function cleanLocalstorage() {
162
window.localStorage.clear();
173
}
184

19-
/**
20-
* returns true if the current environment supports webrtc
21-
*/
22-
export function browserSupportsWebRTC() {
23-
const n = global.window.navigator;
24-
return n.getUserMedia || n.webkitGetUserMedia ||
25-
n.mozGetUserMedia;
26-
}
27-
285
export function deleteIndexedDB(dbName) {
296
return new Promise((resolve, reject) => {
307
if (!window.indexedDB) {

0 commit comments

Comments
 (0)