mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-02-13 10:52:53 +00:00
32 lines
993 B
JavaScript
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) {}
|
|
});
|
|
});
|
|
});
|