Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Elmer Bulthuis committed May 6, 2024
1 parent 8a0bfa2 commit 88a0c56
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/npm/reverse/src/operation-handlers/reverse.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import assert from "assert";
import test from "node:test";
import * as api from "reverse-api";
import * as operationHandlers from "../operation-handlers/index.js";

test("reverse", async () => {
const server = new api.Server();

// register only one operation handler
server.registerReverseOperation(operationHandlers.reverse);

await using listener = await api.lib.listen(server);

const result = await api.reverse(
{
contentType: "text/plain",
value: () => "123",
},
{},
{ baseUrl: new URL(`http://localhost:${listener.port}`) },
);

assert(result.status === 200);

const resultValue = await result.value();

assert.equal(resultValue, "321");
});
3 changes: 3 additions & 0 deletions scripts/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ for (const name of names) {
],
options,
);

cp.execFileSync("npm", ["--workspace", name, "ci"], options);
cp.execFileSync("npm", ["--workspace", name, "run", "build"], options);
}

0 comments on commit 88a0c56

Please sign in to comment.