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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
d6dd2f5f
Commit
d6dd2f5f
authored
Mar 29, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated tests to use testAction helper
parent
aaa7dbb4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
48 deletions
+55
-48
spec/javascripts/ide/stores/actions/file_spec.js
spec/javascripts/ide/stores/actions/file_spec.js
+27
-0
spec/javascripts/ide/stores/actions_spec.js
spec/javascripts/ide/stores/actions_spec.js
+28
-48
No files found.
spec/javascripts/ide/stores/actions/file_spec.js
View file @
d6dd2f5f
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
store
from
'
~/ide/stores
'
;
import
store
from
'
~/ide/stores
'
;
import
*
as
actions
from
'
~/ide/stores/actions/file
'
;
import
*
as
types
from
'
~/ide/stores/mutation_types
'
;
import
service
from
'
~/ide/services
'
;
import
service
from
'
~/ide/services
'
;
import
router
from
'
~/ide/ide_router
'
;
import
router
from
'
~/ide/ide_router
'
;
import
eventHub
from
'
~/ide/eventhub
'
;
import
eventHub
from
'
~/ide/eventhub
'
;
import
{
file
,
resetStore
}
from
'
../../helpers
'
;
import
{
file
,
resetStore
}
from
'
../../helpers
'
;
import
testAction
from
'
../../../helpers/vuex_action_helper
'
;
describe
(
'
Multi-file store file actions
'
,
()
=>
{
describe
(
'
Multi-file store file actions
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
...
@@ -418,4 +421,28 @@ describe('Multi-file store file actions', () => {
...
@@ -418,4 +421,28 @@ describe('Multi-file store file actions', () => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
});
});
describe
(
'
stageChange
'
,
()
=>
{
it
(
'
calls STAGE_CHANGE with file path
'
,
done
=>
{
testAction
(
actions
.
stageChange
,
'
path
'
,
null
,
[{
type
:
types
.
STAGE_CHANGE
,
payload
:
'
path
'
}],
done
,
);
});
});
describe
(
'
unstageChange
'
,
()
=>
{
it
(
'
calls UNSTAGE_CHANGE with file path
'
,
done
=>
{
testAction
(
actions
.
unstageChange
,
'
path
'
,
null
,
[{
type
:
types
.
UNSTAGE_CHANGE
,
payload
:
'
path
'
}],
done
,
);
});
});
});
});
spec/javascripts/ide/stores/actions_spec.js
View file @
d6dd2f5f
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
store
from
'
~/ide/stores
'
;
import
store
from
'
~/ide/stores
'
;
import
*
as
actions
from
'
~/ide/stores/actions
'
;
import
*
as
types
from
'
~/ide/stores/mutation_types
'
;
import
router
from
'
~/ide/ide_router
'
;
import
router
from
'
~/ide/ide_router
'
;
import
{
resetStore
,
file
}
from
'
../helpers
'
;
import
{
resetStore
,
file
}
from
'
../helpers
'
;
import
testAction
from
'
../../helpers/vuex_action_helper
'
;
describe
(
'
Multi-file store actions
'
,
()
=>
{
describe
(
'
Multi-file store actions
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
...
@@ -191,9 +194,7 @@ describe('Multi-file store actions', () => {
...
@@ -191,9 +194,7 @@ describe('Multi-file store actions', () => {
})
})
.
then
(
f
=>
{
.
then
(
f
=>
{
expect
(
f
.
tempFile
).
toBeTruthy
();
expect
(
f
.
tempFile
).
toBeTruthy
();
expect
(
store
.
state
.
trees
[
'
abcproject/mybranch
'
].
tree
.
length
).
toBe
(
expect
(
store
.
state
.
trees
[
'
abcproject/mybranch
'
].
tree
.
length
).
toBe
(
1
);
1
,
);
done
();
done
();
})
})
...
@@ -294,56 +295,35 @@ describe('Multi-file store actions', () => {
...
@@ -294,56 +295,35 @@ describe('Multi-file store actions', () => {
describe
(
'
stageAllChanges
'
,
()
=>
{
describe
(
'
stageAllChanges
'
,
()
=>
{
it
(
'
adds all files from changedFiles to stagedFiles
'
,
done
=>
{
it
(
'
adds all files from changedFiles to stagedFiles
'
,
done
=>
{
const
f
=
file
();
store
.
state
.
changedFiles
.
push
(
file
(),
file
(
'
new
'
));
store
.
state
.
changedFiles
.
push
(
f
);
store
.
state
.
changedFiles
.
push
(
file
(
'
new
'
));
testAction
(
actions
.
stageAllChanges
,
store
.
state
.
changedFiles
.
forEach
(
localFile
=>
{
null
,
store
.
state
.
entries
[
localFile
.
path
]
=
localFile
;
store
.
state
,
});
[
{
type
:
types
.
STAGE_CHANGE
,
payload
:
store
.
state
.
changedFiles
[
0
].
path
},
store
{
type
:
types
.
STAGE_CHANGE
,
payload
:
store
.
state
.
changedFiles
[
1
].
path
},
.
dispatch
(
'
stageAllChanges
'
)
],
.
then
(()
=>
{
done
,
expect
(
store
.
state
.
stagedFiles
.
length
).
toBe
(
2
);
);
expect
(
store
.
state
.
stagedFiles
[
0
]).
toEqual
(
f
);
done
();
})
.
catch
(
done
.
fail
);
});
});
});
});
describe
(
'
unstageAllChanges
'
,
()
=>
{
describe
(
'
unstageAllChanges
'
,
()
=>
{
let
f
;
beforeEach
(()
=>
{
f
=
{
...
file
(),
type
:
'
blob
'
,
staged
:
true
,
};
store
.
state
.
changedFiles
.
push
({
...
f
,
});
store
.
state
.
changedFiles
.
forEach
(
localFile
=>
{
store
.
state
.
entries
[
localFile
.
path
]
=
localFile
;
});
});
it
(
'
removes all files from stagedFiles after unstaging
'
,
done
=>
{
it
(
'
removes all files from stagedFiles after unstaging
'
,
done
=>
{
store
.
state
.
stagedFiles
.
push
(
file
());
store
.
state
.
stagedFiles
.
push
(
file
(),
file
(
'
new
'
));
store
testAction
(
.
dispatch
(
'
unstageAllChanges
'
)
actions
.
unstageAllChanges
,
.
then
(()
=>
{
null
,
expect
(
store
.
state
.
stagedFiles
.
length
).
toBe
(
0
);
store
.
state
,
[
done
();
{
type
:
types
.
UNSTAGE_CHANGE
,
payload
:
store
.
state
.
stagedFiles
[
0
].
path
},
})
{
type
:
types
.
UNSTAGE_CHANGE
,
payload
:
store
.
state
.
stagedFiles
[
1
].
path
},
.
catch
(
done
.
fail
);
],
done
,
);
});
});
});
});
...
...
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