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
0e972e44
Commit
0e972e44
authored
5 years ago
by
Angelina Filippova
Browse files
Options
Downloads
Patches
Plain Diff
Add test for forming search object
parent
2d7b742b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!125
WIP: Release/2.0.3
,
!102
Implement settings search
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/views/settings/formSearchObject.test.js
+213
-0
213 additions, 0 deletions
test/views/settings/formSearchObject.test.js
with
213 additions
and
0 deletions
test/views/settings/formSearchObject.test.js
0 → 100644
+
213
−
0
View file @
0e972e44
import
{
formSearchObject
}
from
'
@/store/modules/normalizers
'
import
_
from
'
lodash
'
describe
(
'
Form search object
'
,
()
=>
{
it
(
'
forms search object for regular setting
'
,
()
=>
{
const
description
=
[{
description
:
"
Upload general settings
"
,
group
:
"
:pleroma
"
,
key
:
"
Pleroma.Upload
"
,
label
:
"
Pleroma.Upload
"
,
children
:
[
{
description
:
"
Module which will be used for uploads
"
,
key
:
"
:uploader
"
,
label
:
"
Uploader
"
},
{
description
:
"
List of filter modules for uploads
"
,
key
:
"
:filters
"
,
label
:
"
Filters
"
}
]
}]
const
expected
=
[
{
label
:
"
Pleroma.Upload
"
,
key
:
"
Pleroma.Upload
"
,
groupKey
:
"
Pleroma.Upload
"
,
groupLabel
:
"
Pleroma.Upload
"
,
search
:
[
"
pleroma.upload
"
,
"
pleroma.upload
"
,
"
upload general settings
"
]
},
{
label
:
"
Uploader
"
,
key
:
"
:uploader
"
,
groupKey
:
"
Pleroma.Upload
"
,
groupLabel
:
"
Pleroma.Upload
"
,
search
:
[
"
:uploader
"
,
"
uploader
"
,
"
module which will be used for uploads
"
]
},
{
label
:
"
Filters
"
,
key
:
"
:filters
"
,
groupKey
:
"
Pleroma.Upload
"
,
groupLabel
:
"
Pleroma.Upload
"
,
search
:
[
"
:filters
"
,
"
filters
"
,
"
list of filter modules for uploads
"
]
}
]
expect
(
_
.
isEqual
(
formSearchObject
(
description
),
expected
)).
toBeTruthy
()
})
it
(
'
forms search object for setting without key
'
,
()
=>
{
const
description
=
[{
description
:
"
`Swoosh.Adapters.Local` adapter specific settings
"
,
group
:
"
:swoosh
"
,
label
:
"
Swoosh
"
,
children
:
[
{
description
:
"
Run the preview server together as part of your app
"
,
group
:
[
"
:subgroup
"
,
"
Swoosh.Adapters.Local
"
],
key
:
"
:serve_mailbox
"
,
label
:
"
Serve mailbox
"
}
]
}]
const
expected
=
[
{
label
:
"
Swoosh
"
,
key
:
"
:swoosh
"
,
groupKey
:
"
:swoosh
"
,
groupLabel
:
"
Swoosh
"
,
search
:
[
"
swoosh
"
,
"
`swoosh.adapters.local` adapter specific settings
"
]
},
{
label
:
"
Serve mailbox
"
,
key
:
"
:serve_mailbox
"
,
groupKey
:
"
:swoosh
"
,
groupLabel
:
"
Swoosh
"
,
search
:
[
"
:serve_mailbox
"
,
"
serve mailbox
"
,
"
run the preview server together as part of your app
"
]
}
]
expect
(
_
.
isEqual
(
formSearchObject
(
description
),
expected
)).
toBeTruthy
()
})
it
(
'
forms search object for setting without key
'
,
()
=>
{
const
description
=
[{
group
:
"
:cors_plug
"
,
label
:
"
Cors plug
"
,
children
:
[
{
key
:
"
:max_age
"
,
label
:
"
Max age
"
},
{
key
:
"
:methods
"
,
label
:
"
Methods
"
}
]
}]
const
expected
=
[
{
label
:
"
Cors plug
"
,
key
:
"
:cors_plug
"
,
groupKey
:
"
:cors_plug
"
,
groupLabel
:
"
Cors plug
"
,
search
:
[
"
cors plug
"
]
},
{
label
:
"
Max age
"
,
key
:
"
:max_age
"
,
groupKey
:
"
:cors_plug
"
,
groupLabel
:
"
Cors plug
"
,
search
:
[
"
:max_age
"
,
"
max age
"
]
},
{
label
:
"
Methods
"
,
key
:
"
:methods
"
,
groupKey
:
"
:cors_plug
"
,
groupLabel
:
"
Cors plug
"
,
search
:
[
"
:methods
"
,
"
methods
"
]
}
]
expect
(
_
.
isEqual
(
formSearchObject
(
description
),
expected
)).
toBeTruthy
()
})
it
(
'
forms search object for setting without key in pleroma group
'
,
()
=>
{
const
description
=
[{
description
:
"
Allows to set a token
"
,
group
:
"
:pleroma
"
,
label
:
"
Pleroma
"
,
children
:
[
{
description
:
"
Token
"
,
key
:
"
:admin_token
"
,
label
:
"
Admin token
"
}
]
}]
const
expected
=
[{
label
:
"
Admin token
"
,
key
:
"
:admin_token
"
,
groupKey
:
"
:pleroma
"
,
groupLabel
:
"
Pleroma
"
,
search
:
[
"
:admin_token
"
,
"
admin token
"
,
"
token
"
]
}]
expect
(
_
.
isEqual
(
formSearchObject
(
description
),
expected
)).
toBeTruthy
()
})
it
(
'
forms search object for nested setting
'
,
()
=>
{
const
description
=
[{
description
:
"
Media proxy
"
,
group
:
"
:pleroma
"
,
key
:
"
:media_proxy
"
,
label
:
"
Media proxy
"
,
children
:
[
{
description
:
"
Options for Pleroma.ReverseProxy
"
,
key
:
"
:proxy_opts
"
,
label
:
"
Proxy opts
"
,
children
:
[
{
description
:
"
HTTP options
"
,
key
:
"
:http
"
,
label
:
"
Http
"
,
children
:
[
{
description
:
"
Adapter specific options
"
,
key
:
"
:adapter
"
,
label
:
"
Adapter
"
,
children
:
[
{
description
:
"
SSL options for HTTP adapter
"
,
key
:
"
:ssl_options
"
,
label
:
"
SSL Options
"
}
]
}
]
}
]}
]
}]
const
expected
=
[
{
label
:
"
Media proxy
"
,
key
:
"
:media_proxy
"
,
groupKey
:
"
:media_proxy
"
,
groupLabel
:
"
Media proxy
"
,
search
:
[
"
:media_proxy
"
,
"
media proxy
"
,
"
media proxy
"
]
},
{
label
:
"
Proxy opts
"
,
key
:
"
:proxy_opts
"
,
groupKey
:
"
:media_proxy
"
,
groupLabel
:
"
Media proxy
"
,
search
:
[
"
:proxy_opts
"
,
"
proxy opts
"
,
"
options for pleroma.reverseproxy
"
]
},
{
label
:
"
Http
"
,
key
:
"
:http
"
,
groupKey
:
"
:media_proxy
"
,
groupLabel
:
"
Media proxy
"
,
search
:
[
"
:http
"
,
"
http
"
,
"
http options
"
]
},
{
label
:
"
Adapter
"
,
key
:
"
:adapter
"
,
groupKey
:
"
:media_proxy
"
,
groupLabel
:
"
Media proxy
"
,
search
:
[
"
:adapter
"
,
"
adapter
"
,
"
adapter specific options
"
]
},
{
label
:
"
SSL Options
"
,
key
:
"
:ssl_options
"
,
groupKey
:
"
:media_proxy
"
,
groupLabel
:
"
Media proxy
"
,
search
:
[
"
:ssl_options
"
,
"
ssl options
"
,
"
ssl options for http adapter
"
]
}
]
expect
(
_
.
isEqual
(
formSearchObject
(
description
),
expected
)).
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