Files
anonymous_github/test/github.test.js
tdurieux a2d0f0b212 v2 wip
2021-03-16 11:23:16 +01:00

32 lines
993 B
JavaScript

var expect = require("chai").expect;
var assert = require("chai").assert;
const fs = require("fs");
const githubUtils = require("../utils/github");
const repoUtils = require("../utils/repository");
const db = require("../utils/database");
describe("Test GitHub Utils", async function() {
describe("Download Repository", function() {
const target = "/tmp/repo.zip";
it("Download an exisiting repo to a folder", async function() {
await repoUtils.downloadRepoZip(
{ fullName: "tdurieux/binance-trade-bot" },
target
);
expect(fs.existsSync(target)).to.equal(true, `${target} should exist`);
fs.unlinkSync(target);
});
it("Download a non-exisiting repo to a folder", async function() {
try {
await repoUtils.downloadRepoZip(
{ fullName: "tdurieux/missing" },
target
);
fs.unlinkSync(target);
assert.fail("Should trigger an exception");
} catch (error) {}
});
});
});