Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Coder
code-server
提交
723a2745
C
code-server
项目概览
镜像
/
Coder
/
code-server
2022-09-21 03:15:05同步失败
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
code-server
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
723a2745
编写于
7月 12, 2021
作者:
J
Joe Previte
提交者:
GitHub
7月 12, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3769 from cdr/jsjoeio-chore-cleanup
refactor: clean up testing files
上级
a5cf0184
fc16f7e0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
15 addition
and
17 deletion
+15
-17
test/unit/browser/pages/login.test.ts
test/unit/browser/pages/login.test.ts
+3
-3
test/unit/browser/pages/vscode.test.ts
test/unit/browser/pages/vscode.test.ts
+1
-1
test/unit/browser/register.test.ts
test/unit/browser/register.test.ts
+6
-6
test/unit/browser/serviceWorker.test.ts
test/unit/browser/serviceWorker.test.ts
+4
-4
test/unit/node/util.test.ts
test/unit/node/util.test.ts
+1
-3
未找到文件。
test/browser/pages/login.test.ts
→
test/
unit/
browser/pages/login.test.ts
浏览文件 @
723a2745
import
{
JSDOM
}
from
"
jsdom
"
import
{
LocationLike
}
from
"
../../u
nit/u
til.test
"
import
{
LocationLike
}
from
"
../../util.test
"
describe
(
"
login
"
,
()
=>
{
describe
(
"
there is an element with id 'base'
"
,
()
=>
{
...
...
@@ -36,7 +36,7 @@ describe("login", () => {
document
.
body
.
appendChild
(
mockElement
)
spy
.
mockImplementation
(()
=>
mockElement
)
// Load file
require
(
"
../../../src/browser/pages/login
"
)
require
(
"
../../../
../
src/browser/pages/login
"
)
const
el
:
HTMLInputElement
|
null
=
document
.
querySelector
(
"
input#base
"
)
expect
(
el
?.
value
).
toBe
(
"
/hello-world
"
)
...
...
@@ -80,7 +80,7 @@ describe("login", () => {
it
(
"
should do nothing
"
,
()
=>
{
spy
.
mockImplementation
(()
=>
null
)
// Load file
require
(
"
../../../src/browser/pages/login
"
)
require
(
"
../../../
../
src/browser/pages/login
"
)
// It's called once by getOptions in the top of the file
// and then another to get the base element
...
...
test/unit/browser/vscode.test.ts
→
test/unit/browser/
pages/
vscode.test.ts
浏览文件 @
723a2745
...
...
@@ -6,7 +6,7 @@ import {
getNlsConfiguration
,
nlsConfigElementId
,
setBodyBackgroundToThemeBackgroundColor
,
}
from
"
../../../src/browser/pages/vscode
"
}
from
"
../../../
../
src/browser/pages/vscode
"
describe
(
"
vscode
"
,
()
=>
{
describe
(
"
getNlsConfiguration
"
,
()
=>
{
...
...
test/unit/register.test.ts
→
test/unit/
browser/
register.test.ts
浏览文件 @
723a2745
import
{
JSDOM
}
from
"
jsdom
"
import
{
registerServiceWorker
}
from
"
../../src/browser/register
"
import
{
createLoggerMock
}
from
"
../utils/helpers
"
import
{
LocationLike
}
from
"
./util.test
"
import
{
registerServiceWorker
}
from
"
../../
../
src/browser/register
"
import
{
createLoggerMock
}
from
"
../
../
utils/helpers
"
import
{
LocationLike
}
from
"
.
.
/util.test
"
describe
(
"
register
"
,
()
=>
{
describe
(
"
when navigator and serviceWorker are defined
"
,
()
=>
{
...
...
@@ -50,7 +50,7 @@ describe("register", () => {
it
(
"
should register a ServiceWorker
"
,
()
=>
{
// Load service worker like you would in the browser
require
(
"
../../src/browser/register
"
)
require
(
"
../../
../
src/browser/register
"
)
expect
(
mockRegisterFn
).
toHaveBeenCalled
()
expect
(
mockRegisterFn
).
toHaveBeenCalledTimes
(
1
)
})
...
...
@@ -64,7 +64,7 @@ describe("register", () => {
})
// Load service worker like you would in the browser
require
(
"
../../src/browser/register
"
)
require
(
"
../../
../
src/browser/register
"
)
expect
(
mockRegisterFn
).
toHaveBeenCalled
()
expect
(
loggerModule
.
logger
.
error
).
toHaveBeenCalled
()
...
...
@@ -88,7 +88,7 @@ describe("register", () => {
it
(
"
should log an error
"
,
()
=>
{
// Load service worker like you would in the browser
require
(
"
../../src/browser/register
"
)
require
(
"
../../
../
src/browser/register
"
)
expect
(
loggerModule
.
logger
.
error
).
toHaveBeenCalled
()
expect
(
loggerModule
.
logger
.
error
).
toHaveBeenCalledTimes
(
1
)
expect
(
loggerModule
.
logger
.
error
).
toHaveBeenCalledWith
(
"
[Service Worker] navigator is undefined
"
)
...
...
test/unit/serviceWorker.test.ts
→
test/unit/
browser/
serviceWorker.test.ts
浏览文件 @
723a2745
...
...
@@ -58,7 +58,7 @@ describe("serviceWorker", () => {
})
it
(
"
should add 3 listeners: install, activate and fetch
"
,
()
=>
{
require
(
"
../../src/browser/serviceWorker.ts
"
)
require
(
"
../../
../
src/browser/serviceWorker.ts
"
)
const
listenerEventNames
=
listeners
.
map
((
listener
)
=>
listener
.
event
)
expect
(
listeners
).
toHaveLength
(
3
)
...
...
@@ -68,20 +68,20 @@ describe("serviceWorker", () => {
})
it
(
"
should call the proper callbacks for 'install'
"
,
async
()
=>
{
require
(
"
../../src/browser/serviceWorker.ts
"
)
require
(
"
../../
../
src/browser/serviceWorker.ts
"
)
emit
(
"
install
"
)
expect
(
spy
).
toHaveBeenCalledWith
(
"
[Service Worker] installed
"
)
expect
(
spy
).
toHaveBeenCalledTimes
(
1
)
})
it
(
"
should do nothing when 'fetch' is called
"
,
async
()
=>
{
require
(
"
../../src/browser/serviceWorker.ts
"
)
require
(
"
../../
../
src/browser/serviceWorker.ts
"
)
emit
(
"
fetch
"
)
expect
(
spy
).
not
.
toHaveBeenCalled
()
})
it
(
"
should call the proper callbacks for 'activate'
"
,
async
()
=>
{
require
(
"
../../src/browser/serviceWorker.ts
"
)
require
(
"
../../
../
src/browser/serviceWorker.ts
"
)
emit
(
"
activate
"
)
// Activate serviceWorker
...
...
test/unit/node/util.test.ts
浏览文件 @
723a2745
...
...
@@ -469,9 +469,7 @@ describe("pathToFsPath", () => {
util
// @ts-expect-error We need to check other types
.
pathToFsPath
({}),
).
toThrow
(
`Could not compute fsPath from given uri. Expected path to be of type string, but was of type undefined.`
,
)
).
toThrow
(
`Could not compute fsPath from given uri. Expected path to be of type string, but was of type undefined.`
)
})
it
(
"
should not throw an error for a string array
"
,
()
=>
{
// @ts-expect-error We need to check other types
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录