Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
65da7854
Commit
65da7854
authored
Apr 26, 2021
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unit test for new scalar type
parent
266ff8f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
spec/graphql/types/duration_type_spec.rb
spec/graphql/types/duration_type_spec.rb
+29
-0
No files found.
spec/graphql/types/duration_type_spec.rb
0 → 100644
View file @
65da7854
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
GitlabSchema
.
types
[
'Duration'
]
do
let
(
:duration
)
{
17
.
minutes
}
it
'presents information as a floating point number'
do
expect
(
described_class
.
coerce_isolated_result
(
duration
)).
to
eq
(
duration
.
to_f
)
end
it
'accepts integers as input'
do
expect
(
described_class
.
coerce_isolated_input
(
100
)).
to
eq
(
100.0
)
end
it
'accepts floats as input'
do
expect
(
described_class
.
coerce_isolated_input
(
0.5
)).
to
eq
(
0.5
)
end
it
'rejects invalid input'
do
expect
{
described_class
.
coerce_isolated_input
(
'not valid'
)
}
.
to
raise_error
(
GraphQL
::
CoercionError
)
end
it
'rejects nil'
do
expect
{
described_class
.
coerce_isolated_input
(
nil
)
}
.
to
raise_error
(
GraphQL
::
CoercionError
)
end
end
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