get status with options

This commit is contained in:
Michael C
2021-09-01 23:24:43 -04:00
parent cfefb7c629
commit 664db71104
3 changed files with 42 additions and 3 deletions

View File

@@ -22,4 +22,40 @@ describe("getStatus", () => {
})
.catch(err => done(err));
});
it("Should be able to get uptime only", (done: Done) => {
fetch(`${getbaseURL()}/api/status/uptime`)
.then(async res => {
assert.strictEqual(res.status, 200);
const data = await res.text();
console.log(data);
assert.ok(Number(data) >= 1); // uptime should be greater than 1s
done();
})
.catch(err => done(err));
});
it("Should be able to get commit only", (done: Done) => {
fetch(`${getbaseURL()}/api/status/commit`)
.then(async res => {
assert.strictEqual(res.status, 200);
const data = await res.text();
console.log(data);
assert.strictEqual(data, "test"); // commit should be test
done();
})
.catch(err => done(err));
});
it("Should be able to get db only", (done: Done) => {
fetch(`${getbaseURL()}/api/status/db`)
.then(async res => {
assert.strictEqual(res.status, 200);
const data = await res.text();
console.log(data);
assert.strictEqual(Number(data), Number(dbVersion)); // commit should be test
done();
})
.catch(err => done(err));
});
});