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,11 +1,11 @@
import { IKubeApiParsed, parseKubeApi } from "./kube-api-parse";
import { IKubeApiParsed, parseKubeApi } from "../kube-api-parse";
interface KubeApi_Parse_Test {
interface KubeApiParseTestData {
url: string;
expected: Required<IKubeApiParsed>;
}
const tests: KubeApi_Parse_Test[] = [
const tests: KubeApiParseTestData[] = [
{
url: "/apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions/prometheuses.monitoring.coreos.com",
expected: {
@@ -125,11 +125,10 @@ const tests: KubeApi_Parse_Test[] = [
},
];
describe.only("parseApi unit tests", () => {
for (const i in tests) {
const { url: tUrl, expected:tExpect} = tests[i];
test(`test #${parseInt(i)+1}`, () => {
expect(parseKubeApi(tUrl)).toStrictEqual(tExpect);
describe("parseApi unit tests", () => {
for (const { url, expected } of tests) {
test(`testing "${url}"`, () => {
expect(parseKubeApi(url)).toStrictEqual(expected);
});
}
});