Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F8922147
table.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
table.test.ts
View Options
import
{
Table
}
from
"./table.js"
;
import
{
Structured
}
from
"./structured.js"
;
import
{
List
}
from
"./list.js"
;
import
{
ShortText
}
from
"./short-text.js"
;
import
{
ExtractParsed
}
from
"./component-argument.js"
;
import
assert
from
"assert"
;
import
{
makeSimpleEnglishJDDContext
}
from
"../jdd-context.js"
;
describe
(
"table argument"
,
()
=>
{
it
(
"properly parses type value"
,
()
=>
{
const
table_arg
=
new
Table
(
new
Structured
(
<
const
>
{
value
:
new
ShortText
().
setExampleValues
([
""
]),
tags
:
new
List
(
new
ShortText
()),
}),
new
Structured
({
tags
:
new
List
(
new
ShortText
()).
setExampleValues
([[
"okazja"
]]),
})
);
const
table_value
=
{
rows
:
[
{
type
:
"row"
,
cells
:
[]
},
{
type
:
"header"
,
value
:
""
,
tags
:
[]
},
],
}
as
ExtractParsed
<
typeof
table_arg
>
;
table_value
.
rows
.
map
((
row
)
=>
{
if
(
row
.
type
==
"row"
)
{
row
.
cells
.
map
((
cell
)
=>
{
cell
.
tags
.
map
((
tag
)
=>
tag
);
// if the types are written correctly, this will typecheck OK
});
}
});
});
it
(
"properly respects custom set example value"
,
async
()
=>
{
const
table_arg
=
new
Table
(
new
ShortText
(),
new
ShortText
()
).
setExampleValues
([{
rows
:
[]
}]);
assert
.
deepStrictEqual
(
await
table_arg
.
getExampleValue
(
makeSimpleEnglishJDDContext
()),
{
rows
:
[]
}
);
});
});
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Sat, Sep 20, 14:18 (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
932298
Default Alt Text
table.test.ts (1 KB)
Attached To
Mode
rJDD jdd
Attached
Detach File
Event Timeline
Log In to Comment