Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Bouquillon committed Jan 15, 2024
1 parent a784f38 commit 730e5fe
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion init/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ outputs:

runs:
using: "node20"
main: "src/index.mjs"
main: "src/index.js"
2 changes: 1 addition & 1 deletion init/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "dashlord-init-action",
"version": "1.0.0",
"description": "Load the dashlord configuration",
"main": "src/index.mjs",
"main": "src/index.js",
"scripts": {
"lint": "eslint .",
"test": "jest",
Expand Down
17 changes: 11 additions & 6 deletions init/src/index.mjs → init/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from "fs";
import core from "@actions/core";
import YAML from "yaml";
import { createMissingUpdownEntries } from "./updown.mjs";
const fs = require("fs");
const core = require("@actions/core");
const YAML = require("yaml");
const { createMissingUpdownEntries } = require("./updown");

const getDashlordConfig = () => {
let dashlordConfig;
Expand Down Expand Up @@ -135,5 +135,10 @@ async function run() {
if (require.main === module) {
run();
}

module.exports = { run, getOutputs, getSiteTools, getSiteSubpages };
module.exports = {
run,
getOutputs,
getDashlordConfig,
getSiteTools,
getSiteSubpages,
};
1 change: 1 addition & 0 deletions init/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const sampleConfig = jest
.readFileSync(path.join(__dirname, "..", "dashlord.yml"))
.toString();

//jest.mock("fs");
jest.mock("fs", () => ({
promises: {
access: jest.fn(),
Expand Down
2 changes: 1 addition & 1 deletion init/src/updown.mjs → init/src/updown.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ const createMissingUpdownEntries = async (dashlordConfig) => {
});
};

module.exports = { createMissingUpdownEntries };
module.export = { createMissingUpdownEntries };

0 comments on commit 730e5fe

Please sign in to comment.