Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22421995
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/tests/unit-tests/base-chips/field-types/file.test.js b/tests/unit-tests/base-chips/field-types/file.test.js
index 0b1f4d85..2fc54a93 100644
--- a/tests/unit-tests/base-chips/field-types/file.test.js
+++ b/tests/unit-tests/base-chips/field-types/file.test.js
@@ -1,39 +1,42 @@
"use strict";
const locreq = require("locreq")(__dirname);
const Context = locreq("lib/context.js");
const field_type_file = locreq("lib/base-chips/field-types/file.js");
const test_is_proper_value = locreq("tests/util/test-is-proper-value.js");
const File = locreq("lib/data-structures/file.js");
const assert = require("assert");
describe("FieldType.File", function(){
test_is_proper_value({
field_type: field_type_file,
should_accept: [
["a File instance", new File()],
["an object with filename and data attributes", {
filename: "test_filename",
data: new Buffer(1)
}],
+ ["a proper URL to a downloadable file", "http://example.com"],
],
should_reject: [
["a random string of text", "asofihas9efbaw837 asd"],
["an empty objec", {}],
["an object with 'filename', but without 'data'", {filename: "picture.jpg"}],
+ ["a malformed http url", "htpp://example.com"],
+ ["a properly formed, but non-existing http url", "http://www.da3bba42e1f6d77a63bd665d0a82ff32.org"],
]
});
it("checks if encode works correctly (value_in_code is false)", function(){
assert.strictEqual(field_type_file.encode(new Context(), {}, false), null);
});
it("checks if decode works correctly (value_in_database is false, params.no_file_value is not given)", function(){
assert.strictEqual(field_type_file.decode(new Context(), {}, false), undefined);
});
it("checks if decode works correctly (value_in_database is false, params.no_file_value is given)", function(){
assert.strictEqual(field_type_file.decode(new Context(), {no_file_value: "test"}, false), "test");
});
});
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Nov 28, 03:15 (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1218341
Default Alt Text
(1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline