rhizome/__tests__/run/001-single-node.ts

43 lines
866 B
TypeScript
Raw Normal View History

2024-12-25 19:32:02 -06:00
import {App} from "../../util/app";
2024-12-25 16:13:48 -06:00
describe('Run', () => {
let app: App;
beforeAll(async () => {
app = new App({
httpPort: 5000,
httpEnable: true,
requestBindPort: 5001,
publishBindPort: 5002,
});
await app.start();
});
afterAll(async () => {
await app.stop();
});
it('can put a new user', async () => {
const {httpAddr, httpPort} = app.config;
const res = await fetch(`http://${httpAddr}:${httpPort}/users`, {
2024-12-25 16:13:48 -06:00
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
id: "peon-1",
2024-12-25 19:27:36 -06:00
properties: {
name: "Peon",
age: 263
}
2024-12-25 16:13:48 -06:00
})
});
const data = await res.json();
expect(data).toMatchObject({
2024-12-25 19:27:36 -06:00
id: "peon-1",
2024-12-25 16:13:48 -06:00
properties: {
name: "Peon",
age: 263
}
});
});
});