Skip to content

Commit 5558d8e

Browse files
authored
chore(base): add an integration test for Supabase.ai (#468)
1 parent 65c4e17 commit 5558d8e

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const session = new Supabase.ai.Session('gte-small');
2+
3+
export default {
4+
async fetch() {
5+
// Generate embedding
6+
const embedding = await session.run("meow", {
7+
mean_pool: true,
8+
normalize: true
9+
});
10+
11+
return new Response(
12+
null,
13+
{
14+
status: embedding instanceof Array ? 200 : 500
15+
}
16+
);
17+
}
18+
}

crates/base/tests/integration_tests.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2856,6 +2856,26 @@ async fn test_tmp_fs_should_not_be_available_in_import_stmt() {
28562856
);
28572857
}
28582858

2859+
#[tokio::test]
2860+
#[serial]
2861+
async fn test_supabase_ai_gte() {
2862+
let tb = TestBedBuilder::new("./test_cases/main")
2863+
.with_per_worker_policy(None)
2864+
.build()
2865+
.await;
2866+
2867+
let resp = tb
2868+
.request(|b| {
2869+
b.uri("/supabase-ai")
2870+
.body(Body::empty())
2871+
.context("can't make request")
2872+
})
2873+
.await
2874+
.unwrap();
2875+
2876+
assert_eq!(resp.status().as_u16(), StatusCode::OK);
2877+
}
2878+
28592879
// -- sb_ai: ORT @huggingface/transformers
28602880
async fn test_ort_transformers_js(script_path: &str) {
28612881
fn visit_json(value: &mut serde_json::Value) {

0 commit comments

Comments
 (0)