提交 c1bff640 authored 作者: 钟是志's avatar 钟是志

删除垃圾代码

上级 3ada453a
......@@ -42,7 +42,11 @@ const queryConfig = (key) => {
const dynamicConfig = typeof globalThis !== 'undefined' ? globalThis.CONFIG : window.CONFIG;
// console.log(dynamicConfig);
if (typeof key === 'undefined') return dynamicConfig;
if (dynamicConfig[key] && typeof dynamicConfig[key] === 'string' && process.env.NODE_ENV === 'development') {
if (dynamicConfig[key] &&
typeof dynamicConfig[key] === 'string' &&
process.env.NODE_ENV === 'development' &&
window.location.href.indexOf('onestopmobile') <= -1
) {
let url = dynamicConfig[key];
url = url.replace('https://yx.bpi.edu.cn/produce', window.location.origin + '/produce');
url = url.replace('http://scjoyedu.eicp.net:51352/produce', window.location.origin + '/produce');
......
import { isUrl } from './utils';
describe('isUrl tests', () => {
it('should return false for invalid and corner case inputs', () => {
expect(isUrl([])).toBeFalsy();
expect(isUrl({})).toBeFalsy();
expect(isUrl(false)).toBeFalsy();
expect(isUrl(true)).toBeFalsy();
expect(isUrl(NaN)).toBeFalsy();
expect(isUrl(null)).toBeFalsy();
expect(isUrl(undefined)).toBeFalsy();
expect(isUrl('')).toBeFalsy();
});
it('should return false for invalid URLs', () => {
expect(isUrl('foo')).toBeFalsy();
expect(isUrl('bar')).toBeFalsy();
expect(isUrl('bar/test')).toBeFalsy();
expect(isUrl('http:/example.com/')).toBeFalsy();
expect(isUrl('ttp://example.com/')).toBeFalsy();
});
it('should return true for valid URLs', () => {
expect(isUrl('http://example.com/')).toBeTruthy();
expect(isUrl('https://example.com/')).toBeTruthy();
expect(isUrl('http://example.com/test/123')).toBeTruthy();
expect(isUrl('https://example.com/test/123')).toBeTruthy();
expect(isUrl('http://example.com/test/123?foo=bar')).toBeTruthy();
expect(isUrl('https://example.com/test/123?foo=bar')).toBeTruthy();
expect(isUrl('http://www.example.com/')).toBeTruthy();
expect(isUrl('https://www.example.com/')).toBeTruthy();
expect(isUrl('http://www.example.com/test/123')).toBeTruthy();
expect(isUrl('https://www.example.com/test/123')).toBeTruthy();
expect(isUrl('http://www.example.com/test/123?foo=bar')).toBeTruthy();
expect(isUrl('https://www.example.com/test/123?foo=bar')).toBeTruthy();
});
});
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论