Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Sunny_yiyi
Swagger Ui
提交
f1f239b0
S
Swagger Ui
项目概览
Sunny_yiyi
/
Swagger Ui
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Swagger Ui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f1f239b0
编写于
3月 22, 2017
作者:
K
Kyle Shockey
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Delete unused AST tests
上级
df9e93fc
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
0 addition
and
268 deletion
+0
-268
test/core/plugins/ast/ast-manager.js
test/core/plugins/ast/ast-manager.js
+0
-268
未找到文件。
test/core/plugins/ast/ast-manager.js
已删除
100644 → 0
浏览文件 @
df9e93fc
/* eslint-env mocha */
import
expect
from
"
expect
"
import
{
pathForPosition
,
positionRangeForPath
}
from
"
corePlugins/ast/ast
"
describe
.
skip
(
"
ASTManager
"
,
function
()
{
describe
(
"
#pathForPosition
"
,
function
()
{
describe
(
"
out of range
"
,
function
()
{
it
(
"
returns empty array for out of range row
"
,
function
(
done
)
{
var
position
=
{
line
:
3
,
column
:
0
}
var
assertPath
=
function
(
path
)
{
expect
(
path
).
toEqual
([])
done
()
}
pathForPosition
(
"
swagger: 2.0
"
,
position
)
.
then
(
assertPath
)
})
it
(
"
returns empty array for out of range column
"
,
function
(
done
)
{
var
position
=
{
line
:
0
,
column
:
100
}
var
assertPath
=
function
(
path
)
{
expect
(
path
).
toEqual
([])
done
()
}
pathForPosition
(
"
swagger: 2.0
"
,
position
)
.
then
(
assertPath
)
})
})
describe
(
"
when document is a simple hash `swagger: 2.0`
"
,
function
()
{
it
(
"
should return empty array when pointer is at middle of the hash key
"
,
function
(
done
)
{
var
position
=
{
line
:
0
,
column
:
3
}
pathForPosition
(
"
swagger: 2.0
"
,
position
).
then
(
function
(
path
)
{
expect
(
path
).
toEqual
([])
done
()
})
})
it
(
"
should return ['swagger'] when pointer is at the value
"
,
function
(
done
)
{
var
position
=
{
line
:
0
,
column
:
10
}
pathForPosition
(
"
swagger: 2.0
"
,
position
).
then
(
function
(
path
)
{
expect
(
path
).
toEqual
([
"
swagger
"
])
done
()
})
})
})
describe
(
"
when document is an array: ['abc', 'cde']
"
,
function
()
{
var
yaml
=
[
/*
0
01234567 */
/* 0 */
"
- abc
"
,
/* 1 */
"
- def
"
].
join
(
"
\n
"
)
it
(
"
should return empty array when pointer is at array dash
"
,
function
(
done
)
{
var
position
=
{
line
:
0
,
column
:
0
}
pathForPosition
(
yaml
,
position
).
then
(
function
(
path
)
{
expect
(
path
).
toEqual
([])
done
()
})
})
it
(
"
should return ['0'] when pointer is at abc
"
,
function
(
done
)
{
var
position
=
{
line
:
0
,
column
:
3
}
pathForPosition
(
yaml
,
position
).
then
(
function
(
path
)
{
expect
(
path
).
toEqual
([
"
0
"
])
done
()
})
})
it
(
"
should return ['1'] when pointer is at abc
"
,
function
(
done
)
{
var
position
=
{
line
:
1
,
column
:
3
}
pathForPosition
(
yaml
,
position
).
then
(
function
(
path
)
{
expect
(
path
).
toEqual
([
"
1
"
])
done
()
})
})
})
describe
(
"
when document is an array of arrays
"
,
function
()
{
var
yaml
=
[
/*
0 10
0123456789012345 */
/* 0 */
"
-
"
,
/* 1 */
"
- abc
"
,
/* 2 */
"
- def
"
,
/* 3 */
"
-
"
,
/* 4 */
"
- ABC
"
,
/* 5 */
"
- DEF
"
].
join
(
"
\n
"
)
it
(
"
should return ['0', '0'] when pointer is at 'abc'
"
,
function
(
done
)
{
var
position
=
{
line
:
1
,
column
:
5
}
pathForPosition
(
yaml
,
position
).
then
(
function
(
path
)
{
expect
(
path
).
toEqual
([
"
0
"
,
"
0
"
])
done
()
})
})
})
describe
(
"
when document is an array of hashs
"
,
function
()
{
var
yaml
=
[
/*
0 10
0123456789012345 */
/* 0 */
"
- key: value
"
,
/* 1 */
"
num: 1
"
,
/* 2 */
"
- name: Tesla
"
,
/* 3 */
"
year: 2016
"
].
join
(
"
\n
"
)
it
(
"
should return ['0'] when pointer is at 'key'
"
,
function
(
done
)
{
var
position
=
{
line
:
0
,
column
:
3
}
pathForPosition
(
yaml
,
position
).
then
(
function
(
path
)
{
expect
(
path
).
toEqual
([
"
0
"
])
done
()
})
})
it
(
"
should return ['0', 'key'] when pointer is at 'value'
"
,
function
(
done
)
{
var
position
=
{
line
:
0
,
column
:
9
}
pathForPosition
(
yaml
,
position
).
then
(
function
(
path
)
{
expect
(
path
).
toEqual
([
"
0
"
,
"
key
"
])
done
()
})
})
it
(
"
should return ['1', 'year'] when pointer is at '2016'
"
,
function
(
done
)
{
var
position
=
{
line
:
3
,
column
:
10
}
pathForPosition
(
yaml
,
position
).
then
(
function
(
path
)
{
expect
(
path
).
toEqual
([
"
1
"
,
"
year
"
])
done
()
})
})
})
describe
(
"
full document
"
,
function
()
{
var
yaml
=
[
/*
0 10 20 30
012345678901234567890123456789012345678 */
/* 0 */
"
swagger: '2.0'
"
,
/* 1 */
"
info:
"
,
/* 2 */
"
title: Test document
"
,
/* 3 */
"
version: 0.0.1
"
,
/* 4 */
"
contact:
"
,
/* 5 */
"
name: Sahar
"
,
/* 6 */
"
url: github.com
"
,
/* 7 */
"
email: me@example.com
"
,
/* 8 */
"
"
].
join
(
"
\n
"
)
it
(
"
should return ['info', 'contact', 'email'] when pointer is at me@
"
,
function
(
done
)
{
var
position
=
{
line
:
7
,
column
:
13
}
pathForPosition
(
yaml
,
position
).
then
(
function
(
path
)
{
expect
(
path
).
toEqual
([
"
info
"
,
"
contact
"
,
"
email
"
])
done
()
})
})
})
})
describe
(
"
#positionRangeForPath
"
,
function
()
{
it
(
"
return {{-1, -1}, {-1, -1}} for invalid paths
"
,
function
(
done
)
{
var
yaml
=
[
"
key: value
"
,
"
anotherKey: value
"
].
join
(
"
\n
"
)
positionRangeForPath
(
yaml
,
[
"
invalid
"
])
.
then
(
function
(
position
)
{
expect
(
position
.
start
).
toEqual
({
line
:
-
1
,
column
:
-
1
})
expect
(
position
.
end
).
toEqual
({
line
:
-
1
,
column
:
-
1
})
done
()
})
})
describe
(
"
when document is a simple hash `swagger: 2.0`
"
,
function
()
{
var
yaml
=
"
swagger: 2.0
"
it
(
"
return {0, 0} for start of empty array path (root)
"
,
function
(
done
)
{
positionRangeForPath
(
yaml
,
[]).
then
(
function
(
position
)
{
expect
(
position
.
start
).
toEqual
({
line
:
0
,
column
:
0
})
done
()
})
})
it
(
"
return {0, 12} for end of empty array path (root)
"
,
function
(
done
)
{
positionRangeForPath
(
yaml
,
[]).
then
(
function
(
position
)
{
expect
(
position
.
end
).
toEqual
({
line
:
0
,
column
:
12
})
done
()
})
})
it
(
"
return {0, 9} for start of ['swagger']
"
,
function
(
done
)
{
positionRangeForPath
(
yaml
,
[
"
swagger
"
]).
then
(
function
(
position
)
{
expect
(
position
.
start
).
toEqual
({
line
:
0
,
column
:
9
})
done
()
})
})
it
(
"
return {0, 12} for end of ['swagger']
"
,
function
(
done
)
{
positionRangeForPath
(
yaml
,
[
"
swagger
"
]).
then
(
function
(
position
)
{
expect
(
position
.
end
).
toEqual
({
line
:
0
,
column
:
12
})
done
()
})
})
})
describe
(
"
when document is an array of primitives
"
,
function
()
{
var
yaml
=
[
"
key:
"
,
"
- value1
"
,
"
- value2
"
].
join
(
"
\n
"
)
it
(
"
returns {1, 4} for ['key', '0']
"
,
function
(
done
)
{
positionRangeForPath
(
yaml
,
[
"
key
"
,
"
0
"
]).
then
(
function
(
position
)
{
expect
(
position
.
start
).
toEqual
({
line
:
1
,
column
:
4
})
done
()
})
})
})
describe
(
"
full document
"
,
function
()
{
var
yaml
=
[
/*
0 10 20 30
012345678901234567890123456789012345678 */
/* 0 */
"
swagger: '2.0'
"
,
/* 1 */
"
info:
"
,
/* 2 */
"
title: Test document
"
,
/* 3 */
"
version: 0.0.1
"
,
/* 4 */
"
contact:
"
,
/* 5 */
"
name: Sahar
"
,
/* 6 */
"
url: github.com
"
,
/* 7 */
"
email: me@example.com
"
,
/* 8 */
"
"
].
join
(
"
\n
"
)
it
(
"
returns {2, 2} for start of ['info']
"
,
function
(
done
)
{
positionRangeForPath
(
yaml
,
[
"
info
"
]).
then
(
function
(
position
)
{
expect
(
position
.
start
).
toEqual
({
line
:
2
,
column
:
2
})
done
()
})
})
it
(
"
returns {5, 10} for start of ['info', 'contact', 'name']
"
,
function
(
done
)
{
positionRangeForPath
(
yaml
,
[
"
info
"
,
"
contact
"
,
"
name
"
]).
then
(
function
(
position
)
{
expect
(
position
.
start
).
toEqual
({
line
:
5
,
column
:
10
})
done
()
})
})
it
(
"
returns {5, 15} for end of ['info', 'contact', 'name']
"
,
function
(
done
)
{
positionRangeForPath
(
yaml
,
[
"
info
"
,
"
contact
"
,
"
name
"
]).
then
(
function
(
position
)
{
expect
(
position
.
end
).
toEqual
({
line
:
5
,
column
:
15
})
done
()
})
})
})
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录