Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F1262953
file.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
file.test.ts
View Options
import
assert
from
"assert"
;
import
File
from
"./file"
;
import
FileField
from
"../app/base-chips/field-types/file"
;
import
{
Collection
,
SuperContext
}
from
"../main"
;
import
{
withRunningApp
}
from
"../test_utils/with-test-app"
;
import
{
TestApp
}
from
"../test_utils/test-utils"
;
describe
(
"file"
,
()
=>
{
it
(
"should return hello world file"
,
()
=>
{
return
withRunningApp
(
(
test_app_type
)
=>
{
return
class
extends
test_app_type
{
collections
=
{
...
TestApp
.
BaseCollections
,
with_file
:
new
(
class
extends
Collection
{
fields
=
{
file
:
new
FileField
(),
};
})(),
};
};
},
async
({
app
,
rest_api
})
=>
{
const
context
=
new
SuperContext
(
app
);
const
buff
=
Buffer
.
from
(
"Hello world!"
,
"utf-8"
);
const
file
=
await
File
.
fromData
(
app
,
buff
,
"test-file.txt"
);
const
response
=
await
app
.
collections
.
with_file
.
create
(
context
,
{
file
,
}
);
const
item
=
await
app
.
collections
.
with_file
.
getByID
(
context
,
response
.
id
);
const
api_response
=
await
rest_api
.
get
(
item
.
get
(
"file"
)
as
string
);
assert
.
strictEqual
(
api_response
,
"Hello world!"
);
}
);
});
});
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Fri, Jan 24, 15:16 (17 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
601627
Default Alt Text
file.test.ts (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment