Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F996544
list.test.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
list.test.ts
View Options
import
{
FileManager
}
from
"@sealcode/file-manager"
;
import
{
makeSimpleEnglishJDDContext
}
from
"../jdd-context.js"
;
import
{
ExtractParsed
}
from
"./component-argument.js"
;
import
{
Image
}
from
"./image.js"
;
import
{
List
}
from
"./list.js"
;
import
{
ShortText
}
from
"./short-text.js"
;
import
assert
from
"assert"
;
describe
(
"list"
,
()
=>
{
it
(
"allows for creating a list of images"
,
()
=>
{
new
List
(
new
Image
());
});
it
(
"properly parses list arguments"
,
()
=>
{
const
images_arg
=
new
List
(
new
Image
());
const
images
=
[]
as
ExtractParsed
<
typeof
images_arg
>
;
images
.
map
((
e
)
=>
e
?
.
file_manager
);
// if the types are right, this should typecheck OK
const
strings_arg
=
new
List
(
new
ShortText
()).
setExampleValues
([
[
"a tag"
],
]);
const
strings
=
[]
as
ExtractParsed
<
typeof
strings_arg
>
;
strings
.
map
((
e
)
=>
e
?
.
padStart
(
0
));
// if the types are right, this should typecheck OK
});
it
(
"handles undefined value"
,
async
()
=>
{
const
strings_arg
=
new
List
(
new
ShortText
());
const
value
=
await
strings_arg
.
receivedToParsed
(
makeSimpleEnglishJDDContext
(
new
FileManager
(
"/tmp"
,
"/uploaded_files"
)
),
undefined
);
assert
(
Array
.
isArray
(
value
));
assert
(
value
.
length
==
0
);
});
});
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Tue, Dec 24, 14:05 (9 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557307
Default Alt Text
list.test.ts (1 KB)
Attached To
Mode
R130 jdd
Attached
Detach File
Event Timeline
Log In to Comment