more endpoints!

This commit is contained in:
Michael C
2021-09-01 23:49:18 -04:00
parent 664db71104
commit 74626f8e3f
2 changed files with 29 additions and 4 deletions

View File

@@ -15,9 +15,11 @@ describe("getStatus", () => {
.then(async res => {
assert.strictEqual(res.status, 200);
const data = await res.json();
assert.ok(data.uptime >= 1); // uptime should be greater than 1s
assert.ok(data.uptime); // uptime should be greater than 1s
assert.strictEqual(data.commit, "test");
assert.strictEqual(data.db, Number(dbVersion));
assert.ok(data.startTime);
assert.ok(data.processTime >= 0);
done();
})
.catch(err => done(err));
@@ -28,7 +30,6 @@ describe("getStatus", () => {
.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();
})
@@ -40,7 +41,6 @@ describe("getStatus", () => {
.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();
})
@@ -52,10 +52,32 @@ describe("getStatus", () => {
.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));
});
it("Should be able to get startTime only", (done: Done) => {
fetch(`${getbaseURL()}/api/status/startTime`)
.then(async res => {
assert.strictEqual(res.status, 200);
const data = await res.text();
const now = Date.now();
assert.ok(Number(data) <= now); // startTime should be more than now
done();
})
.catch(err => done(err));
});
it("Should be able to get processTime only", (done: Done) => {
fetch(`${getbaseURL()}/api/status/processTime`)
.then(async res => {
assert.strictEqual(res.status, 200);
const data = await res.text();
assert.ok(Number(data) >= 0);
done();
})
.catch(err => done(err));
});
});