Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
cec51edc
Commit
cec51edc
authored
Apr 17, 2020
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use snake case for action types
This is more conventional in our usage of Redux elsewhere in the app.
parent
4f0dbb9b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
watch-test.js
src/sidebar/util/test/watch-test.js
+8
-8
No files found.
src/sidebar/util/test/watch-test.js
View file @
cec51edc
...
@@ -4,9 +4,9 @@ import { watch } from '../watch';
...
@@ -4,9 +4,9 @@ import { watch } from '../watch';
function
counterReducer
(
state
=
{
a
:
0
,
b
:
0
},
action
)
{
function
counterReducer
(
state
=
{
a
:
0
,
b
:
0
},
action
)
{
switch
(
action
.
type
)
{
switch
(
action
.
type
)
{
case
'
increment-a
'
:
case
'
INCREMENT_A
'
:
return
{
...
state
,
a
:
state
.
a
+
1
};
return
{
...
state
,
a
:
state
.
a
+
1
};
case
'
increment-b
'
:
case
'
INCREMENT_B
'
:
return
{
...
state
,
b
:
state
.
b
+
1
};
return
{
...
state
,
b
:
state
.
b
+
1
};
default
:
default
:
return
state
;
return
state
;
...
@@ -28,10 +28,10 @@ describe('sidebar/util/watch', () => {
...
@@ -28,10 +28,10 @@ describe('sidebar/util/watch', () => {
watch
(
store
.
subscribe
,
()
=>
store
.
getState
().
a
,
callback
);
watch
(
store
.
subscribe
,
()
=>
store
.
getState
().
a
,
callback
);
store
.
dispatch
({
type
:
'
increment-a
'
});
store
.
dispatch
({
type
:
'
INCREMENT_A
'
});
assert
.
calledWith
(
callback
,
1
,
0
);
assert
.
calledWith
(
callback
,
1
,
0
);
store
.
dispatch
({
type
:
'
increment-a
'
});
store
.
dispatch
({
type
:
'
INCREMENT_A
'
});
assert
.
calledWith
(
callback
,
2
,
1
);
assert
.
calledWith
(
callback
,
2
,
1
);
});
});
...
@@ -40,7 +40,7 @@ describe('sidebar/util/watch', () => {
...
@@ -40,7 +40,7 @@ describe('sidebar/util/watch', () => {
const
store
=
counterStore
();
const
store
=
counterStore
();
watch
(
store
.
subscribe
,
()
=>
store
.
getState
().
a
,
callback
);
watch
(
store
.
subscribe
,
()
=>
store
.
getState
().
a
,
callback
);
store
.
dispatch
({
type
:
'
increment-b
'
});
store
.
dispatch
({
type
:
'
INCREMENT_B
'
});
assert
.
notCalled
(
callback
);
assert
.
notCalled
(
callback
);
});
});
...
@@ -54,7 +54,7 @@ describe('sidebar/util/watch', () => {
...
@@ -54,7 +54,7 @@ describe('sidebar/util/watch', () => {
[()
=>
store
.
getState
().
a
,
()
=>
store
.
getState
().
b
],
[()
=>
store
.
getState
().
a
,
()
=>
store
.
getState
().
b
],
callback
callback
);
);
store
.
dispatch
({
type
:
'
increment-a
'
});
store
.
dispatch
({
type
:
'
INCREMENT_A
'
});
assert
.
calledWith
(
callback
,
[
1
,
0
],
[
0
,
0
]);
assert
.
calledWith
(
callback
,
[
1
,
0
],
[
0
,
0
]);
});
});
...
@@ -68,13 +68,13 @@ describe('sidebar/util/watch', () => {
...
@@ -68,13 +68,13 @@ describe('sidebar/util/watch', () => {
()
=>
store
.
getState
().
a
,
()
=>
store
.
getState
().
a
,
callback
callback
);
);
store
.
dispatch
({
type
:
'
increment-a
'
});
store
.
dispatch
({
type
:
'
INCREMENT_A
'
});
assert
.
calledWith
(
callback
,
1
,
0
);
assert
.
calledWith
(
callback
,
1
,
0
);
callback
.
resetHistory
();
callback
.
resetHistory
();
unsubscribe
();
unsubscribe
();
store
.
dispatch
({
type
:
'
increment-a
'
});
store
.
dispatch
({
type
:
'
INCREMENT_A
'
});
assert
.
notCalled
(
callback
);
assert
.
notCalled
(
callback
);
});
});
...
...
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