@ramonyx/testing 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +13 -2
- package/dist/index.d.ts +14 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/package.json +30 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ramonymous
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ramonyx/testing
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Paket framework Ramonyx.
|
|
4
|
+
|
|
5
|
+
> **Alpha (0.1.0)** — framework Node.js ini adalah baseline produksi;
|
|
6
|
+
> runtime Rust/V8 bersifat eksperimental. Butuh **Node.js ≥ 24**.
|
|
7
|
+
|
|
8
|
+
## Instalasi
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @ramonyx/testing
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Repo: https://github.com/RamonyxJS/ramonyx · Lisensi: MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FetchHandler } from "@ramonyx/core";
|
|
2
|
+
import { type CreateHandlerOptions } from "@ramonyx/server";
|
|
3
|
+
export interface TestServer {
|
|
4
|
+
readonly url: string;
|
|
5
|
+
fetch(input: string | URL | Request, init?: RequestInit): Promise<Response>;
|
|
6
|
+
close(): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Server in-memory dari handler siap pakai (mis. hasil `createApp`).
|
|
10
|
+
* Tidak membuka port, tidak butuh runtime sendiri.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createTestServerFromHandler(handler: FetchHandler): Promise<TestServer>;
|
|
13
|
+
/** Server in-memory dari manifest route + middleware (opsi `createHandler`). */
|
|
14
|
+
export declare function createTestServer(options: CreateHandlerOptions): Promise<TestServer>;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createMemoryHost } from "@ramonyx/adapter-runtime";
|
|
2
|
+
import { createHandler } from "@ramonyx/server";
|
|
3
|
+
function wrap(server) {
|
|
4
|
+
return {
|
|
5
|
+
url: server.url,
|
|
6
|
+
fetch(input, init) {
|
|
7
|
+
const request = input instanceof Request ? input : new Request(new URL(String(input), server.url), init);
|
|
8
|
+
return server.fetch(request);
|
|
9
|
+
},
|
|
10
|
+
close: () => server.close(),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Server in-memory dari handler siap pakai (mis. hasil `createApp`).
|
|
15
|
+
* Tidak membuka port, tidak butuh runtime sendiri.
|
|
16
|
+
*/
|
|
17
|
+
export async function createTestServerFromHandler(handler) {
|
|
18
|
+
const host = createMemoryHost();
|
|
19
|
+
return wrap(await host.serve(handler));
|
|
20
|
+
}
|
|
21
|
+
/** Server in-memory dari manifest route + middleware (opsi `createHandler`). */
|
|
22
|
+
export async function createTestServer(options) {
|
|
23
|
+
return createTestServerFromHandler(createHandler(options));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/testing/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAqB,MAAM,0BAA0B,CAAC;AAE/E,OAAO,EAA6B,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAQ3E,SAAS,IAAI,CAAC,MAAoB;IAChC,OAAO;QACL,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,KAAK,CAAC,KAAK,EAAE,IAAI;YACf,MAAM,OAAO,GACX,KAAK,YAAY,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;YAC3F,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;QACD,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE;KAC5B,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,OAAqB;IACrE,MAAM,IAAI,GAAG,gBAAgB,EAAE,CAAC;IAChC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AACzC,CAAC;AAED,gFAAgF;AAChF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAA6B;IAClE,OAAO,2BAA2B,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import { createMemoryHost, type MemoryServer } from \"@ramonyx/adapter-runtime\";\nimport type { FetchHandler } from \"@ramonyx/core\";\nimport { type CreateHandlerOptions, createHandler } from \"@ramonyx/server\";\n\nexport interface TestServer {\n readonly url: string;\n fetch(input: string | URL | Request, init?: RequestInit): Promise<Response>;\n close(): Promise<void>;\n}\n\nfunction wrap(server: MemoryServer): TestServer {\n return {\n url: server.url,\n fetch(input, init) {\n const request =\n input instanceof Request ? input : new Request(new URL(String(input), server.url), init);\n return server.fetch(request);\n },\n close: () => server.close(),\n };\n}\n\n/**\n * Server in-memory dari handler siap pakai (mis. hasil `createApp`).\n * Tidak membuka port, tidak butuh runtime sendiri.\n */\nexport async function createTestServerFromHandler(handler: FetchHandler): Promise<TestServer> {\n const host = createMemoryHost();\n return wrap(await host.serve(handler));\n}\n\n/** Server in-memory dari manifest route + middleware (opsi `createHandler`). */\nexport async function createTestServer(options: CreateHandlerOptions): Promise<TestServer> {\n return createTestServerFromHandler(createHandler(options));\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ramonyx/testing",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Paket framework Ramonyx.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=24"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@ramonyx/adapter-runtime": "^0.1.0",
|
|
23
|
+
"@ramonyx/core": "^0.1.0",
|
|
24
|
+
"@ramonyx/server": "^0.1.0"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/RamonyxJS/ramonyx"
|
|
32
|
+
}
|
|
6
33
|
}
|