mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-02-13 19:02:45 +00:00
v2 wip
This commit is contained in:
31
test/github.test.js
Normal file
31
test/github.test.js
Normal file
@@ -0,0 +1,31 @@
|
||||
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) {}
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user