Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
retribute.me
webclient
Commits
1eda1348
Verified
Commit
1eda1348
authored
Jun 06, 2019
by
Eliot Berriot
Browse files
Fixed some mutations issues
parent
7d1cb367
Pipeline
#4227
passed with stages
in 1 minute and 29 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/store.js
View file @
1eda1348
...
...
@@ -17,12 +17,13 @@ export const storeConfig = {
cache
:
{}
},
mutations
:
{
addAccount
(
{
state
}
,
payload
)
{
addAccount
(
state
,
payload
)
{
const
id
=
sources
.
sources
[
payload
.
source
].
authDataToKey
(
payload
)
payload
.
id
=
id
state
.
accounts
[
id
]
=
payload
},
setRecursiveState
({
state
},
{
key
,
suffix
,
value
})
{
setRecursiveState
(
state
,
{
key
,
suffix
,
value
})
{
console
.
log
(
'
SETTING RECURSIVE
'
,
key
,
suffix
,
value
,
state
)
if
(
suffix
)
{
let
existing
=
get
(
state
,
key
,
{})
existing
[
suffix
]
=
value
...
...
tests/unit/store.spec.js
View file @
1eda1348
...
...
@@ -14,7 +14,7 @@ describe('mutations', () => {
"
mastodon test.domain user
"
:
payload
}
}
store
.
mutations
.
addAccount
(
{
state
}
,
payload
)
store
.
mutations
.
addAccount
(
state
,
payload
)
expect
(
state
).
to
.
deep
.
equal
(
expected
)
})
it
(
'
setRecursiveState
'
,
()
=>
{
...
...
@@ -28,7 +28,7 @@ describe('mutations', () => {
world
:
"
test.domain
"
}
}
store
.
mutations
.
setRecursiveState
(
{
state
}
,
payload
)
store
.
mutations
.
setRecursiveState
(
state
,
payload
)
expect
(
state
).
to
.
deep
.
equal
(
expected
)
})
it
(
'
setRecursiveState with suffix
'
,
()
=>
{
...
...
@@ -45,7 +45,7 @@ describe('mutations', () => {
}
}
}
store
.
mutations
.
setRecursiveState
(
{
state
}
,
payload
)
store
.
mutations
.
setRecursiveState
(
state
,
payload
)
expect
(
state
).
to
.
deep
.
equal
(
expected
)
})
})
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment