Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
-布谷鸟-
nosqlclient
提交
0613644e
N
nosqlclient
项目概览
-布谷鸟-
/
nosqlclient
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
nosqlclient
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
0613644e
编写于
4月 10, 2019
作者:
R
rsercano
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#480 viewPipelineUpdater tests implemented
上级
ee88d696
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
102 addition
and
6 deletion
+102
-6
client/imports/test/ui/collection/update_view_pipeline.tests.js
.../imports/test/ui/collection/update_view_pipeline.tests.js
+100
-0
client/imports/ui/collection/update_view_pipeline.js
client/imports/ui/collection/update_view_pipeline.js
+2
-6
未找到文件。
client/imports/test/ui/collection/update_view_pipeline.tests.js
浏览文件 @
0613644e
...
...
@@ -197,4 +197,104 @@ describe('CollectionRename', () => {
expect
(
$
.
prototype
.
data
.
getCall
(
0
).
thisValue
.
selector
).
to
.
equal
(
'
#updateViewPipelineModal
'
);
});
});
describe
(
'
updateViewPipeline tests
'
,
()
=>
{
const
viewOn
=
'
collection_name
'
;
const
collMod
=
'
view_name
'
;
const
pipeline
=
123
;
let
jsonEditorStub
;
beforeEach
(()
=>
{
jsonEditorStub
=
{
get
:
sinon
.
stub
().
returns
(
pipeline
)
};
sinon
.
stub
(
$
.
prototype
,
'
val
'
).
returns
(
viewOn
);
sinon
.
stub
(
$
.
prototype
,
'
modal
'
);
sinon
.
stub
(
$
.
prototype
,
'
data
'
).
withArgs
(
'
viewName
'
).
returns
(
collMod
).
withArgs
(
'
jsoneditor
'
)
.
returns
(
jsonEditorStub
);
sinon
.
stub
(
Notification
,
'
start
'
);
sinon
.
stub
(
Notification
,
'
success
'
);
sinon
.
stub
(
ErrorHandler
,
'
showMeteorFuncError
'
);
});
afterEach
(()
=>
{
$
.
prototype
.
val
.
restore
();
$
.
prototype
.
modal
.
restore
();
$
.
prototype
.
data
.
restore
();
Notification
.
start
.
restore
();
Notification
.
success
.
restore
();
ErrorHandler
.
showMeteorFuncError
.
restore
();
Communicator
.
call
.
restore
();
});
it
(
'
updateViewPipeline & communicator yieldsTo error
'
,
()
=>
{
// prepare
const
error
=
{
error
:
'
123
'
};
sinon
.
stub
(
Communicator
,
'
call
'
).
yieldsTo
(
'
callback
'
,
error
,
null
);
// execute
ViewPipelineUpdater
.
updateViewPipeline
();
// verify
expect
(
Notification
.
start
.
callCount
).
to
.
equal
(
1
);
expect
(
Notification
.
start
.
calledWithExactly
(
'
#btnSaveViewPipeline
'
)).
to
.
equal
(
true
);
expect
(
Communicator
.
call
.
callCount
).
to
.
equal
(
1
);
expect
(
Communicator
.
call
.
calledWithMatch
({
methodName
:
'
command
'
,
args
:
{
command
:
{
collMod
,
pipeline
,
viewOn
}
},
callback
:
sinon
.
match
.
func
})).
to
.
equal
(
true
);
expect
(
Notification
.
success
.
callCount
).
to
.
equal
(
0
);
expect
(
ErrorHandler
.
showMeteorFuncError
.
callCount
).
to
.
equal
(
1
);
expect
(
ErrorHandler
.
showMeteorFuncError
.
calledWithExactly
(
error
,
null
)).
to
.
equal
(
true
);
expect
(
$
.
prototype
.
modal
.
callCount
).
to
.
equal
(
0
);
});
it
(
'
updateViewPipeline & communicator yieldsTo error (1)
'
,
()
=>
{
// prepare
const
error
=
{
error
:
'
123
'
};
sinon
.
stub
(
Communicator
,
'
call
'
).
yieldsTo
(
'
callback
'
,
null
,
error
);
// execute
ViewPipelineUpdater
.
updateViewPipeline
();
// verify
expect
(
Notification
.
start
.
callCount
).
to
.
equal
(
1
);
expect
(
Notification
.
start
.
calledWithExactly
(
'
#btnSaveViewPipeline
'
)).
to
.
equal
(
true
);
expect
(
Communicator
.
call
.
callCount
).
to
.
equal
(
1
);
expect
(
Communicator
.
call
.
calledWithMatch
({
methodName
:
'
command
'
,
args
:
{
command
:
{
collMod
,
pipeline
,
viewOn
}
},
callback
:
sinon
.
match
.
func
})).
to
.
equal
(
true
);
expect
(
Notification
.
success
.
callCount
).
to
.
equal
(
0
);
expect
(
ErrorHandler
.
showMeteorFuncError
.
callCount
).
to
.
equal
(
1
);
expect
(
ErrorHandler
.
showMeteorFuncError
.
calledWithExactly
(
null
,
error
)).
to
.
equal
(
true
);
expect
(
$
.
prototype
.
modal
.
callCount
).
to
.
equal
(
0
);
});
it
(
'
updateViewPipeline & communicator yieldsTo success
'
,
()
=>
{
// prepare
sinon
.
stub
(
Communicator
,
'
call
'
).
yieldsTo
(
'
callback
'
,
null
,
{});
// execute
ViewPipelineUpdater
.
updateViewPipeline
();
// verify
expect
(
Notification
.
start
.
callCount
).
to
.
equal
(
1
);
expect
(
Notification
.
start
.
calledWithExactly
(
'
#btnSaveViewPipeline
'
)).
to
.
equal
(
true
);
expect
(
Communicator
.
call
.
callCount
).
to
.
equal
(
1
);
expect
(
Communicator
.
call
.
calledWithMatch
({
methodName
:
'
command
'
,
args
:
{
command
:
{
collMod
,
pipeline
,
viewOn
}
},
callback
:
sinon
.
match
.
func
})).
to
.
equal
(
true
);
expect
(
Notification
.
success
.
callCount
).
to
.
equal
(
1
);
expect
(
Notification
.
success
.
calledWithExactly
(
'
saved-successfully
'
)).
to
.
equal
(
true
);
expect
(
ErrorHandler
.
showMeteorFuncError
.
callCount
).
to
.
equal
(
0
);
expect
(
$
.
prototype
.
modal
.
callCount
).
to
.
equal
(
1
);
expect
(
$
.
prototype
.
modal
.
calledWithExactly
(
'
hide
'
)).
to
.
equal
(
true
);
expect
(
$
.
prototype
.
modal
.
getCall
(
0
).
thisValue
.
selector
).
to
.
equal
(
'
#updateViewPipelineModal
'
);
});
});
});
client/imports/ui/collection/update_view_pipeline.js
浏览文件 @
0613644e
...
...
@@ -56,13 +56,9 @@ ViewPipelineUpdater.prototype = {
Notification
.
start
(
'
#btnSaveViewPipeline
'
);
const
modal
=
$
(
'
#updateViewPipelineModal
'
);
const
pipeline
=
$
(
'
#jsonEditorOfViewPipeline
'
).
data
(
'
jsoneditor
'
).
get
();
const
viewName
=
modal
.
data
(
'
viewName
'
);
const
viewOn
=
$
(
'
#cmbCollectionsUpdateViewPipeline
'
).
val
();
const
command
=
{
collMod
:
viewName
,
pipeline
};
if
(
viewOn
)
{
command
.
viewOn
=
viewOn
;
}
const
command
=
{
collMod
:
modal
.
data
(
'
viewName
'
),
pipeline
:
$
(
'
#jsonEditorOfViewPipeline
'
).
data
(
'
jsoneditor
'
).
get
()
};
if
(
viewOn
)
command
.
viewOn
=
viewOn
;
Communicator
.
call
({
methodName
:
'
command
'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录