MagicMirror/tests/unit/functions/updatenotification_spec.js

30 lines
1.0 KiB
JavaScript
Raw Normal View History

2021-09-07 22:07:42 +02:00
const path = require("path");
const git_Helper = require("../../../modules/default/updatenotification/git_helper.js");
const gitHelper = new git_Helper.gitHelper();
gitHelper.add("default");
let branch = "";
describe("Updatenotification", function () {
// it is assumed that we are at the HEAD of a branch when running this tests
// and we have no foreign modules installed.
it("should return 0 for repo count", async function () {
const arr = await gitHelper.getRepos();
expect(arr.length).toBe(0);
}, 15000);
it("should return valid output for git status", async function () {
const arr = await gitHelper.getStatus();
expect(arr.length).toBe(1);
const gitInfo = arr[0];
branch = gitInfo.current;
expect(gitInfo.current).not.toBe("");
}, 15000);
it("should return no refs for git fetch", async function () {
const baseDir = path.normalize(__dirname + "/../../../");
const res = await gitHelper.execShell("cd " + baseDir + " && git fetch --dry-run");
expect(res.stderr.match(gitHelper.getRefRegex(branch))).toBe(null);
});
});