优化目录结构
This commit is contained in:
39
client/test/helpers/testutils.js
Normal file
39
client/test/helpers/testutils.js
Normal file
@@ -0,0 +1,39 @@
|
||||
import process from "process";
|
||||
|
||||
export function waitFor(conditionFunction) {
|
||||
|
||||
const poll = resolve => {
|
||||
if (conditionFunction()) resolve();
|
||||
else setTimeout(() => poll(resolve), 100);
|
||||
};
|
||||
|
||||
return new Promise(poll);
|
||||
}
|
||||
|
||||
export async function sleep(milisecond) {
|
||||
return new Promise(resolve => setTimeout(resolve, milisecond));
|
||||
}
|
||||
|
||||
export function serverExeName() {
|
||||
switch (process.platform) {
|
||||
case 'win32':
|
||||
return 'webserver.exe';
|
||||
case 'darwin':
|
||||
return 'webserver_mac';
|
||||
case 'linux':
|
||||
return 'webserver';
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function getUniqueId() {
|
||||
return new Date().getTime().toString(16) + Math.floor(1000 * Math.random()).toString(16);
|
||||
}
|
||||
|
||||
export function getRTCConfiguration() {
|
||||
let config = {};
|
||||
config.sdpSemantics = 'unified-plan';
|
||||
config.iceServers = [{ urls: ['stun:stun.l.google.com:19302'] }];
|
||||
return config;
|
||||
}
|
||||
Reference in New Issue
Block a user