Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4ecd8b18
Commit
4ecd8b18
authored
May 21, 2020
by
Nicolò Maria Mezzopera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move droplab hook_spec tests to jest
- jest test - remove karma test
parent
7a533749
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
73 deletions
+94
-73
spec/frontend/droplab/hook_spec.js
spec/frontend/droplab/hook_spec.js
+94
-0
spec/javascripts/droplab/hook_spec.js
spec/javascripts/droplab/hook_spec.js
+0
-73
No files found.
spec/frontend/droplab/hook_spec.js
0 → 100644
View file @
4ecd8b18
import
Hook
from
'
~/droplab/hook
'
;
import
DropDown
from
'
~/droplab/drop_down
'
;
jest
.
mock
(
'
~/droplab/drop_down
'
,
()
=>
jest
.
fn
());
describe
(
'
Hook
'
,
()
=>
{
let
testContext
;
beforeEach
(()
=>
{
testContext
=
{};
});
describe
(
'
class constructor
'
,
()
=>
{
beforeEach
(()
=>
{
testContext
.
trigger
=
{
id
:
'
id
'
};
testContext
.
list
=
{};
testContext
.
plugins
=
{};
testContext
.
config
=
{};
testContext
.
hook
=
new
Hook
(
testContext
.
trigger
,
testContext
.
list
,
testContext
.
plugins
,
testContext
.
config
,
);
});
it
(
'
should set .trigger
'
,
()
=>
{
expect
(
testContext
.
hook
.
trigger
).
toBe
(
testContext
.
trigger
);
});
it
(
'
should set .list
'
,
()
=>
{
expect
(
testContext
.
hook
.
list
).
toEqual
({});
});
it
(
'
should call DropDown constructor
'
,
()
=>
{
expect
(
DropDown
).
toHaveBeenCalledWith
(
testContext
.
list
,
testContext
.
config
);
});
it
(
'
should set .type
'
,
()
=>
{
expect
(
testContext
.
hook
.
type
).
toBe
(
'
Hook
'
);
});
it
(
'
should set .event
'
,
()
=>
{
expect
(
testContext
.
hook
.
event
).
toBe
(
'
click
'
);
});
it
(
'
should set .plugins
'
,
()
=>
{
expect
(
testContext
.
hook
.
plugins
).
toBe
(
testContext
.
plugins
);
});
it
(
'
should set .config
'
,
()
=>
{
expect
(
testContext
.
hook
.
config
).
toBe
(
testContext
.
config
);
});
it
(
'
should set .id
'
,
()
=>
{
expect
(
testContext
.
hook
.
id
).
toBe
(
testContext
.
trigger
.
id
);
});
describe
(
'
if config argument is undefined
'
,
()
=>
{
beforeEach
(()
=>
{
testContext
.
config
=
undefined
;
testContext
.
hook
=
new
Hook
(
testContext
.
trigger
,
testContext
.
list
,
testContext
.
plugins
,
testContext
.
config
,
);
});
it
(
'
should set .config to an empty object
'
,
()
=>
{
expect
(
testContext
.
hook
.
config
).
toEqual
({});
});
});
describe
(
'
if plugins argument is undefined
'
,
()
=>
{
beforeEach
(()
=>
{
testContext
.
plugins
=
undefined
;
testContext
.
hook
=
new
Hook
(
testContext
.
trigger
,
testContext
.
list
,
testContext
.
plugins
,
testContext
.
config
,
);
});
it
(
'
should set .plugins to an empty array
'
,
()
=>
{
expect
(
testContext
.
hook
.
plugins
).
toEqual
([]);
});
});
});
});
spec/javascripts/droplab/hook_spec.js
deleted
100644 → 0
View file @
7a533749
import
Hook
from
'
~/droplab/hook
'
;
describe
(
'
Hook
'
,
function
()
{
describe
(
'
class constructor
'
,
function
()
{
beforeEach
(
function
()
{
this
.
trigger
=
{
id
:
'
id
'
};
this
.
list
=
{};
this
.
plugins
=
{};
this
.
config
=
{};
this
.
dropdown
=
{};
this
.
dropdownConstructor
=
spyOnDependency
(
Hook
,
'
DropDown
'
).
and
.
returnValue
(
this
.
dropdown
);
this
.
hook
=
new
Hook
(
this
.
trigger
,
this
.
list
,
this
.
plugins
,
this
.
config
);
});
it
(
'
should set .trigger
'
,
function
()
{
expect
(
this
.
hook
.
trigger
).
toBe
(
this
.
trigger
);
});
it
(
'
should set .list
'
,
function
()
{
expect
(
this
.
hook
.
list
).
toBe
(
this
.
dropdown
);
});
it
(
'
should call DropDown constructor
'
,
function
()
{
expect
(
this
.
dropdownConstructor
).
toHaveBeenCalledWith
(
this
.
list
,
this
.
config
);
});
it
(
'
should set .type
'
,
function
()
{
expect
(
this
.
hook
.
type
).
toBe
(
'
Hook
'
);
});
it
(
'
should set .event
'
,
function
()
{
expect
(
this
.
hook
.
event
).
toBe
(
'
click
'
);
});
it
(
'
should set .plugins
'
,
function
()
{
expect
(
this
.
hook
.
plugins
).
toBe
(
this
.
plugins
);
});
it
(
'
should set .config
'
,
function
()
{
expect
(
this
.
hook
.
config
).
toBe
(
this
.
config
);
});
it
(
'
should set .id
'
,
function
()
{
expect
(
this
.
hook
.
id
).
toBe
(
this
.
trigger
.
id
);
});
describe
(
'
if config argument is undefined
'
,
function
()
{
beforeEach
(
function
()
{
this
.
config
=
undefined
;
this
.
hook
=
new
Hook
(
this
.
trigger
,
this
.
list
,
this
.
plugins
,
this
.
config
);
});
it
(
'
should set .config to an empty object
'
,
function
()
{
expect
(
this
.
hook
.
config
).
toEqual
({});
});
});
describe
(
'
if plugins argument is undefined
'
,
function
()
{
beforeEach
(
function
()
{
this
.
plugins
=
undefined
;
this
.
hook
=
new
Hook
(
this
.
trigger
,
this
.
list
,
this
.
plugins
,
this
.
config
);
});
it
(
'
should set .plugins to an empty array
'
,
function
()
{
expect
(
this
.
hook
.
plugins
).
toEqual
([]);
});
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment