Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
admin-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Pleroma
admin-fe
Commits
c4746bf9
Commit
c4746bf9
authored
5 years ago
by
Angelina Filippova
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for settings with type atom, string and tuple, tuple and atom
parent
88ea2a03
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!77
Ability to remove settings from db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/modules/normalizers/wrapUpdatedSettings.test.js
+84
-0
84 additions, 0 deletions
test/modules/normalizers/wrapUpdatedSettings.test.js
with
84 additions
and
0 deletions
test/modules/normalizers/wrapUpdatedSettings.test.js
+
84
−
0
View file @
c4746bf9
...
...
@@ -168,4 +168,88 @@ describe('Wrap settings', () => {
expect
(
_
.
isEqual
(
result
,
expectedResult
)).
toBeTruthy
()
})
it
(
'
wraps settings with type atom
'
,
()
=>
{
const
settings
=
{
'
:ldap
'
:
{
'
:sslopts
'
:
[
"
keyword
"
,
{
'
:verify
'
:
[
"
atom
"
,
"
verify_peer
"
]}]},
'
:assets
'
:
{
'
:default_mascot
'
:
[
"
atom
"
,
"
pleroma_fox_tan_test
"
]}
}
const
state
=
{
'
:pleroma
'
:
{
'
:sslopts
'
:
{},
'
:assets
'
:
{}}}
const
result
=
wrapUpdatedSettings
(
'
:pleroma
'
,
settings
,
state
)
const
expectedResult
=
[{
group
:
'
:pleroma
'
,
key
:
'
:ldap
'
,
value
:
[{
tuple
:
[
"
:sslopts
"
,
[{
tuple
:
[
"
:verify
"
,
"
:verify_peer
"
]}]]}]
},
{
group
:
'
:pleroma
'
,
key
:
'
:assets
'
,
value
:
[{
tuple
:
[
"
:default_mascot
"
,
"
:pleroma_fox_tan_test
"
]}]
}]
expect
(
_
.
isEqual
(
result
,
expectedResult
)).
toBeTruthy
()
})
it
(
'
wraps settings with type string and tuple
'
,
()
=>
{
const
settings1
=
{
'
:media_proxy
'
:
{
'
:proxy_opts
'
:
[
"
keyword
"
,
{
'
:http
'
:
[
"
keyword
"
,
{
'
:proxy_url
'
:
[[
"
string
"
,
"
tuple
"
],
"
localhost:9020
"
]}]
}]
}}
const
state1
=
{
'
:pleroma
'
:
{
'
:media_proxy
'
:
{}}}
const
result1
=
wrapUpdatedSettings
(
'
:pleroma
'
,
settings1
,
state1
)
const
expectedResult1
=
[{
group
:
'
:pleroma
'
,
key
:
"
:media_proxy
"
,
value
:
[{
tuple
:
[
"
:proxy_opts
"
,
[
{
tuple
:
[
"
:http
"
,
[{
tuple
:
[
"
:proxy_url
"
,
"
localhost:9020
"
]
}]
]}
]]}]
}]
const
settings2
=
{
'
:media_proxy
'
:
{
'
:proxy_opts
'
:
[
"
keyword
"
,
{
'
:http
'
:
[
"
keyword
"
,
{
'
:proxy_url
'
:
[[
"
string
"
,
"
tuple
"
],
[
"
:socks5
"
,
"
127.0.0.1
"
,
"
9020
"
]]}]
}]
}}
const
state2
=
{
'
:pleroma
'
:
{
'
:media_proxy
'
:
{}}}
const
result2
=
wrapUpdatedSettings
(
'
:pleroma
'
,
settings2
,
state2
)
const
expectedResult2
=
[{
group
:
'
:pleroma
'
,
key
:
"
:media_proxy
"
,
value
:
[{
tuple
:
[
"
:proxy_opts
"
,
[
{
tuple
:
[
"
:http
"
,
[{
tuple
:
[
'
:proxy_url
'
,
{
tuple
:
[
'
:socks5
'
,
'
127.0.0.1
'
,
'
9020
'
]
}]}]
]}
]]}]
}]
expect
(
_
.
isEqual
(
result1
,
expectedResult1
)).
toBeTruthy
()
expect
(
_
.
isEqual
(
result2
,
expectedResult2
)).
toBeTruthy
()
})
it
(
'
wraps settings with type tuple and atom
'
,
()
=>
{
const
settings1
=
{
'
Oban
'
:
{
'
:prune
'
:
[[
"
atom
"
,
"
tuple
"
],
"
:disabled
"
]}}
const
state1
=
{
'
:pleroma
'
:
{
'
Oban
'
:
{}}}
const
result1
=
wrapUpdatedSettings
(
'
:pleroma
'
,
settings1
,
state1
)
const
expectedResult1
=
[{
group
:
'
:pleroma
'
,
key
:
"
Oban
"
,
value
:
[{
tuple
:
[
"
:prune
"
,
"
:disabled
"
]}]
}]
const
settings2
=
{
'
Oban
'
:
{
'
:prune
'
:
[[
"
atom
"
,
"
tuple
"
],
[
"
:maxlen
"
,
1500
]]
}}
const
state2
=
{
'
:pleroma
'
:
{
'
Oban
'
:
{}}}
const
result2
=
wrapUpdatedSettings
(
'
:pleroma
'
,
settings2
,
state2
)
const
expectedResult2
=
[{
group
:
'
:pleroma
'
,
key
:
"
Oban
"
,
value
:
[{
tuple
:
[
"
:prune
"
,
{
tuple
:
[
"
:maxlen
"
,
1500
]}]}]
}]
expect
(
_
.
isEqual
(
result1
,
expectedResult1
)).
toBeTruthy
()
expect
(
_
.
isEqual
(
result2
,
expectedResult2
)).
toBeTruthy
()
})
})
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