Refactor testing harness to use defaults (#808)

* Refactor testing harness to use defaults

- Move tests into defaultly named test folders
- Use default test suffix of ".test" instead of "_test"
- Make cluster-store tests unit tests by adding more
    nesting, so that order of tests doesn't matter

Signed-off-by: Sebastian Malton <sebastian@malton.name>

Co-authored-by: Sebastian Malton <smalton@mirantis.com>
This commit is contained in:
Sebastian MaltonandSebastian Malton authored and GitHub committed 2020-10-02 10:05:59 -04:00
1 parent 14d3d88278
commit 87061cee9e
25 files changed
+345 -307

No files matched your search

@@ -1,4 +1,4 @@
import { formatDuration } from "./formatDuration";
import { formatDuration } from "../formatDuration";
const second = 1000;
const minute = 60 * second;
@@ -9,34 +9,34 @@ const week = 7 * day;
describe("human format durations", () => {
test("long formatted durations less than 24 hours long shouldn't have a 'd' component", () => {
const res = formatDuration(19 * 60 * 60 * 1000, false);
expect(res).not.toContain("d");
expect(res).toBe("19h");
});
test("long formatted durations more than a week have correct day count", () => {
const res = formatDuration(2 * week + 2 * day, false);
expect(res).toBe("2w 2d");
});
test("durations > 1/2 week shouldn't show 1w has passed", () => {
const res = formatDuration(5 * 24 * 60 * 60 * 1000, false);
expect(res).not.toContain("w");
expect(res).toBe("5d");
});
test("durations shouldn't include zero magnitude parts", () => {
const res = formatDuration(6 * day + 2 * minute, false);
expect(res).not.toContain("h");
expect(res).toBe("6d 2m");
});
test("seconds are ignored unless they are significant (< 1m)", () => {
const insignificant = formatDuration(1 * hour + 2 * minute + 31 * second, false);
expect(insignificant).not.toContain("s");
expect(insignificant).toBe("1h 2m");
@@ -1,4 +1,4 @@
import { metricUnitsToNumber } from "./metricUnitsToNumber";
import { metricUnitsToNumber } from "../metricUnitsToNumber";
describe("metricUnitsToNumber tests", () => {
test("plain number", () => {