Page MenuHomeSealhub

float.test.js
No OneTemporary

float.test.js

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

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)

Event Timeline