Skip to content

Commit 9d36635

Browse files
authored
chore: add an integration test for byonm with typescript (#504)
1 parent d32a041 commit 9d36635

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import isodd from "is-odd";
2+
import { createServer } from "node:http";
3+
4+
class Meow {
5+
private meow: boolean;
6+
7+
constructor(odd: number) {
8+
this.meow = isodd(odd);
9+
}
10+
11+
getMeow() {
12+
return this.meow;
13+
}
14+
}
15+
16+
const server = createServer((_, resp) => {
17+
const meow = new Meow(33);
18+
resp.writeHead(200, {
19+
"content-type": "text-plain",
20+
});
21+
resp.write(meow.getMeow() ? "meow" : "meow!!");
22+
resp.end();
23+
});
24+
25+
server.listen(8080);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"workspaces": [],
3+
"main": "meow.ts",
4+
"dependencies": {
5+
"is-odd": "^3.0.1"
6+
}
7+
}

crates/base/tests/integration_tests.rs

+20
Original file line numberDiff line numberDiff line change
@@ -3012,6 +3012,26 @@ async fn test_commonjs_express_websocket() {
30123012
test_commonjs_websocket(String::from("express")).await;
30133013
}
30143014

3015+
#[tokio::test]
3016+
#[serial]
3017+
async fn test_byonm_typescript() {
3018+
ensure_npm_package_installed("./test_cases/byonm-typescript").await;
3019+
integration_test!(
3020+
"./test_cases/main",
3021+
NON_SECURE_PORT,
3022+
"byonm-typescript",
3023+
None,
3024+
None,
3025+
None,
3026+
(|resp| async {
3027+
let resp = resp.unwrap();
3028+
assert_eq!(resp.status().as_u16(), 200);
3029+
assert_eq!(resp.text().await.unwrap().as_str(), "meow");
3030+
}),
3031+
TerminationToken::new()
3032+
);
3033+
}
3034+
30153035
#[tokio::test]
30163036
#[serial]
30173037
async fn test_supabase_ai_gte() {

0 commit comments

Comments
 (0)