Skip to content

Commit

Permalink
refactor: rename built config getters
Browse files Browse the repository at this point in the history
  • Loading branch information
seankwarren committed Feb 12, 2024
1 parent c48bf45 commit e4c5bbf
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export {
loadApplicationExecutableFlavorTree
} from "./assets";

export { getApplicationExecutableFlavorTree } from "./tree";
export { getApplicationExecutableFlavorData } from "./tree";
export { getApplicationVersionBuildData } from "./data";
export { allTemplates } from "./data/templates";
export { applicationVersionBuildTree } from "./data/application_data";
Expand Down
2 changes: 1 addition & 1 deletion src/js/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { applicationExecutableFlavorTree } from "./data/tree";
* @param appName {string}
* @returns {object}
*/
export function getApplicationExecutableFlavorTree(appName: keyof typeof applicationExecutableFlavorTree) {
export function getApplicationExecutableFlavorData(appName: keyof typeof applicationExecutableFlavorTree) {
if (!(appName in applicationExecutableFlavorTree)) {
throw new Error(`${appName} is not a known application with a tree.`);
}
Expand Down
30 changes: 23 additions & 7 deletions tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,19 @@ import {
loadApplicationVersionBuildTree,
loadApplicationTemplates,
loadApplicationExecutableFlavorTree,
getApplicationExecutableFlavorTree,
getApplicationVersionBuildData,
allowedPostProcessors,
allowedApplications,
getApplicationExecutableFlavorData,
} from "../src/js/index";

describe("allowedApplications", () => {
it("should not be empty", () => {
assert(Array.isArray(allowedApplications));
assert(allowedApplications.length > 0);
});
});

describe("allowedResults", () => {
it("should not be empty", () => {
assert(Array.isArray(allowedResults));
Expand All @@ -27,7 +36,14 @@ describe("allowedMonitors", () => {
});
});

describe("ALL_INPUT_TEMPLATES", () => {
describe("allowedPostProcessors", () => {
it("should not be empty", () => {
assert(allowedPostProcessors instanceof Object);
assert(Object.keys(allowedPostProcessors).length > 0);
});
});

describe("loadApplicationTemplates", () => {
const ALL_INPUT_TEMPLATES = loadApplicationTemplates();
assert(Array.isArray(ALL_INPUT_TEMPLATES));
assert(ALL_INPUT_TEMPLATES.length > 0);
Expand All @@ -41,7 +57,7 @@ describe("ALL_INPUT_TEMPLATES", () => {
});
});

describe("getAllAppTree", () => {
describe("loadApplicationExecutableFlavorTree", () => {
let APP_TREE;
before(() => {
APP_TREE = loadApplicationExecutableFlavorTree();
Expand All @@ -52,24 +68,24 @@ describe("getAllAppTree", () => {
});
});

describe("getApplicationExecutableFlavorTree", () => {
describe("getApplicationExecutableFlavorData", () => {
it("raises on unknown application", () => {
expect(() => {
// @ts-expect-error
getApplicationExecutableFlavorTree("unknown_app");
getApplicationExecutableFlavorData("unknown_app");
}).to.throw("unknown_app is not a known application with a tree.");
});
});

describe("getAllAppData", () => {
describe("loadApplicationVersionBuildTree", () => {
it("returns results", () => {
const { nwchem } = loadApplicationVersionBuildTree();
assert("name" in nwchem);
assert(nwchem.name === "nwchem");
});
});

describe("getAppData", () => {
describe("getApplicationVersionBuildData", () => {
it("raises on unknown application", () => {
expect(() => {
// @ts-expect-error
Expand Down

0 comments on commit e4c5bbf

Please sign in to comment.