Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7861668
float.test.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
float.test.js
View Options
const
Context
=
require
.
main
.
require
(
"lib/context.js"
);
const
field_type_float
=
require
.
main
.
require
(
"lib/base-chips/field-types/float.js"
);
const
acceptCorrectly
=
require
.
main
.
require
(
"tests/util/accept-correctly.js"
);
const
rejectCorrectly
=
require
.
main
.
require
(
"tests/util/reject-correctly.js"
);
const
assert
=
require
(
"assert"
);
describe
(
"FieldType.Float"
,
function
(){
it
(
"returns the name of the field type"
,
function
()
{
assert
.
strictEqual
(
field_type_float
.
name
,
"float"
);
});
it
(
"returns the description of the field type"
,
function
(){
assert
.
strictEqual
(
typeof
field_type_float
.
get_description
(),
"string"
);
});
it
(
"checks if is_proper_value works correctly"
,
function
(
done
){
const
{
accept
,
reject
}
=
acceptCorrectly
(
done
);
field_type_float
.
is_proper_value
(
accept
,
reject
,
new
Context
(),
{},
2.5
);
});
it
(
"returns error because new_value is not an integer"
,
function
(
done
){
const
{
accept
,
reject
}
=
rejectCorrectly
(
done
);
field_type_float
.
is_proper_value
(
accept
,
reject
,
new
Context
(),
{},
"janusz"
);
});
it
(
"checks if encode works properly (given \"2\")"
,
function
(){
assert
.
strictEqual
(
field_type_float
.
encode
(
new
Context
(),
{},
"2.5"
),
2.5
);
});
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 13, 19:42 (22 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
872254
Default Alt Text
float.test.js (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment