Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Menu
Open sidebar
fibery-community
public-holidays-app
Commits
bd5797e4
Commit
bd5797e4
authored
Jan 14, 2022
by
Aleh
🐳
Browse files
fix schema
parent
be9acd30
Changes
3
Hide whitespace changes
Inline
Side-by-side
app.js
View file @
bd5797e4
...
...
@@ -53,7 +53,7 @@ app.post(`/api/v1/synchronizer/datalist`, wrap(async (req, res) => {
app
.
post
(
`/api/v1/synchronizer/data`
,
wrap
(
async
(
req
,
res
)
=>
{
const
{
requestedType
,
filter
}
=
req
.
body
;
if
(
requestedType
!==
`holiday
s
`
)
{
if
(
requestedType
!==
`holiday`
)
{
throw
new
Error
(
`Only holidays database can be synchronized`
);
}
if
(
_
.
isEmpty
(
filter
.
countries
))
{
...
...
schema.json
View file @
bd5797e4
{
"schema"
:
{
"holidays"
:
{
"holiday"
:
{
"id"
:
{
"name"
:
"Id"
,
"type"
:
"id"
...
...
@@ -18,5 +17,4 @@
"type"
:
"text"
}
}
}
}
test.js
View file @
bd5797e4
...
...
@@ -37,14 +37,14 @@ describe(`integration app suite`, function () {
});
it
(
`should have schema holidays type defined`
,
async
()
=>
{
const
{
body
:
{
schema
:
{
holiday
s
}
}}
=
await
request
(
app
).
post
(
`/api/v1/synchronizer/schema`
)
.
expect
(
200
).
expect
(
`Content-Type`
,
/json/
);
assert
.
deepEqual
(
holiday
s
.
id
,
{
name
:
`Id`
,
type
:
`id`
});
const
{
body
:
{
holiday
}}
=
await
request
(
app
).
post
(
`/api/v1/synchronizer/schema`
)
.
send
()
.
expect
(
200
).
expect
(
`Content-Type`
,
/json/
);
assert
.
deepEqual
(
holiday
.
id
,
{
name
:
`Id`
,
type
:
`id`
});
});
it
(
`should return data for CY`
,
async
()
=>
{
const
{
body
:
{
items
}}
=
await
request
(
app
).
post
(
`/api/v1/synchronizer/data`
).
send
({
requestedType
:
`holiday
s
`
,
requestedType
:
`holiday`
,
filter
:
{
countries
:
[
`CY`
]
}
...
...
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