Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F995751
search.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
search.test.ts
View Options
import
assert
from
"assert"
;
import
Collection
from
"../chip-types/collection.js"
;
import
{
FieldTypes
}
from
"../main.js"
;
import
{
TestApp
}
from
"../test_utils/test-app.js"
;
import
{
withRunningApp
}
from
"../test_utils/with-test-app.js"
;
describe
(
"search"
,
()
=>
{
it
(
"Performs full-text-search"
,
async
()
=>
{
return
withRunningApp
(
(
test_app
)
=>
{
return
class
extends
test_app
{
collections
=
{
...
TestApp
.
BaseCollections
,
dogs
:
new
(
class
extends
Collection
{
fields
=
{
name
:
new
FieldTypes
.
Text
({
full_text_search
:
true
,
}),
};
})(),
};
};
},
async
({
app
,
rest_api
})
=>
{
await
app
.
collections
.
dogs
.
create
(
new
app
.
Context
(),
{
name
:
"Nora"
,
});
await
app
.
collections
.
dogs
.
create
(
new
app
.
Context
(),
{
name
:
"Greta"
,
});
const
{
items
}
=
(
await
rest_api
.
get
(
"/api/v1/collections/dogs?search=Greta"
))
as
any
;
assert
.
deepEqual
(
items
.
length
,
1
);
const
{
items
:
items2
}
=
await
app
.
collections
[
"dogs"
]
.
list
(
new
app
.
Context
())
.
search
(
"Nora"
)
.
fetch
();
assert
.
deepEqual
(
items2
.
length
,
1
);
const
{
items
:
items3
}
=
await
app
.
collections
[
"dogs"
]
.
list
(
new
app
.
Context
())
.
search
()
.
fetch
();
assert
.
deepEqual
(
items3
.
length
,
2
);
}
);
});
});
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Mon, Dec 23, 14:52 (16 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
554782
Default Alt Text
search.test.ts (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment