Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
logging-scratch-gui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Goessmann
logging-scratch-gui
Commits
5511c7de
Commit
5511c7de
authored
6 years ago
by
Ben Wheeler
Browse files
Options
Downloads
Patches
Plain Diff
added project-saver-hoc tests
parent
53997619
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/unit/util/project-saver-hoc.test.jsx
+65
-10
65 additions, 10 deletions
test/unit/util/project-saver-hoc.test.jsx
with
65 additions
and
10 deletions
test/unit/util/project-saver-hoc.test.jsx
+
65
−
10
View file @
5511c7de
...
...
@@ -30,7 +30,7 @@ describe('projectSaverHOC', () => {
<
WrappedComponent
isShowingWithId
canSave
=
{
false
}
isCreating
=
{
false
}
isCreating
New
=
{
false
}
isShowingWithoutId
=
{
false
}
isUpdating
=
{
false
}
loadingState
=
{
LoadingState
.
SHOWING_WITH_ID
}
...
...
@@ -52,7 +52,7 @@ describe('projectSaverHOC', () => {
const
mounted
=
mount
(
<
WrappedComponent
canSave
isCreating
=
{
false
}
isCreating
New
=
{
false
}
isShowingWithId
=
{
false
}
isShowingWithoutId
=
{
false
}
isUpdating
=
{
false
}
...
...
@@ -78,7 +78,7 @@ describe('projectSaverHOC', () => {
<
WrappedComponent
isShowingWithoutId
canSave
=
{
false
}
isCreating
=
{
false
}
isCreating
New
=
{
false
}
isShowingWithId
=
{
false
}
isUpdating
=
{
false
}
loadingState
=
{
LoadingState
.
LOADING_VM_NEW_DEFAULT
}
...
...
@@ -102,7 +102,7 @@ describe('projectSaverHOC', () => {
<
WrappedComponent
isShowingWithoutId
canCreateNew
=
{
false
}
isCreating
=
{
false
}
isCreating
New
=
{
false
}
isShowingWithId
=
{
false
}
isUpdating
=
{
false
}
loadingState
=
{
LoadingState
.
SHOWING_WITHOUT_ID
}
...
...
@@ -124,7 +124,7 @@ describe('projectSaverHOC', () => {
const
mounted
=
mount
(
<
WrappedComponent
canCreateNew
isCreating
=
{
false
}
isCreating
New
=
{
false
}
isShowingWithId
=
{
false
}
isShowingWithoutId
=
{
false
}
isUpdating
=
{
false
}
...
...
@@ -141,14 +141,16 @@ describe('projectSaverHOC', () => {
expect
(
mockedCreateProject
).
toHaveBeenCalled
();
});
test
(
'
if we enter creating state, vm project should be requested
'
,
()
=>
{
test
(
'
if we enter creating
new
state, vm project should be requested
'
,
()
=>
{
vm
.
saveProjectSb3
=
jest
.
fn
(()
=>
Promise
.
resolve
());
const
Component
=
()
=>
<
div
/>;
const
WrappedComponent
=
projectSaverHOC
(
Component
);
const
mounted
=
mount
(
<
WrappedComponent
canSave
isCreating
=
{
false
}
isCreatingCopy
=
{
false
}
isCreatingNew
=
{
false
}
isRemixing
=
{
false
}
isShowingWithId
=
{
false
}
isShowingWithoutId
=
{
false
}
isUpdating
=
{
false
}
...
...
@@ -159,12 +161,65 @@ describe('projectSaverHOC', () => {
/>
);
mounted
.
setProps
({
isCreating
:
true
,
isCreating
New
:
true
,
loadingState
:
LoadingState
.
CREATING_NEW
});
expect
(
vm
.
saveProjectSb3
).
toHaveBeenCalled
();
});
test
(
'
if we enter remixing state, vm project should be requested
'
,
()
=>
{
vm
.
saveProjectSb3
=
jest
.
fn
(()
=>
Promise
.
resolve
());
const
Component
=
()
=>
<
div
/>;
const
WrappedComponent
=
projectSaverHOC
(
Component
);
const
mounted
=
mount
(
<
WrappedComponent
canSave
isCreatingCopy
=
{
false
}
isCreatingNew
=
{
false
}
isRemixing
=
{
false
}
isShowingWithId
=
{
false
}
isShowingWithoutId
=
{
false
}
isUpdating
=
{
false
}
loadingState
=
{
LoadingState
.
SHOWING_WITH_ID
}
reduxProjectId
=
{
'
100
'
}
store
=
{
store
}
vm
=
{
vm
}
/>
);
mounted
.
setProps
({
isRemixing
:
true
,
loadingState
:
LoadingState
.
REMIXING
});
expect
(
vm
.
saveProjectSb3
).
toHaveBeenCalled
();
});
test
(
'
if we enter creating copy state, vm project should be requested
'
,
()
=>
{
vm
.
saveProjectSb3
=
jest
.
fn
(()
=>
Promise
.
resolve
());
const
Component
=
()
=>
<
div
/>;
const
WrappedComponent
=
projectSaverHOC
(
Component
);
const
mounted
=
mount
(
<
WrappedComponent
canSave
isCreatingCopy
=
{
false
}
isCreatingNew
=
{
false
}
isRemixing
=
{
false
}
isShowingWithId
=
{
false
}
isShowingWithoutId
=
{
false
}
isUpdating
=
{
false
}
loadingState
=
{
LoadingState
.
SHOWING_WITH_ID
}
reduxProjectId
=
{
'
100
'
}
store
=
{
store
}
vm
=
{
vm
}
/>
);
mounted
.
setProps
({
isCreatingCopy
:
true
,
loadingState
:
LoadingState
.
CREATING_COPY
});
expect
(
vm
.
saveProjectSb3
).
toHaveBeenCalled
();
});
test
(
'
if we enter updating/saving state, vm project shold be requested
'
,
()
=>
{
vm
.
saveProjectSb3
=
jest
.
fn
(()
=>
Promise
.
resolve
());
const
Component
=
()
=>
<
div
/>;
...
...
@@ -172,7 +227,7 @@ describe('projectSaverHOC', () => {
const
mounted
=
mount
(
<
WrappedComponent
canSave
isCreating
=
{
false
}
isCreating
New
=
{
false
}
isShowingWithId
=
{
false
}
isShowingWithoutId
=
{
false
}
isUpdating
=
{
false
}
...
...
@@ -197,7 +252,7 @@ describe('projectSaverHOC', () => {
<
WrappedComponent
canSave
isUpdating
isCreating
=
{
false
}
isCreating
New
=
{
false
}
isShowingWithId
=
{
false
}
isShowingWithoutId
=
{
false
}
loadingState
=
{
LoadingState
.
UPDATING
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment