Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
obany committed Jul 22, 2020
1 parent 6f14df7 commit 7b59dec
Show file tree
Hide file tree
Showing 15 changed files with 131 additions and 344 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Changelog

## v0.6.3
## v0.6.4

Refactored to include CLI
Rewritten in TypeScript

## v0.6.2

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion dist/cli.js → dist/src/cli.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env node
#!/usr/bin/env node
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
104 changes: 104 additions & 0 deletions dist/tests/core.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("../src/core");
describe("Tangle Release", () => {
afterEach(() => {
jest.clearAllMocks();
});
test("No GITHUB_TOKEN", () => __awaiter(void 0, void 0, void 0, function* () {
const config = {};
expect(() => core_1.sanitizeInput(config)).toThrow("You must provide the GitHub token option");
}));
test("No owner", () => __awaiter(void 0, void 0, void 0, function* () {
const config = {
githubToken: "aaa"
};
expect(() => core_1.sanitizeInput(config)).toThrow("You must provide the owner option");
}));
test("No repository", () => __awaiter(void 0, void 0, void 0, function* () {
const config = {
githubToken: "aaa",
owner: "abc"
};
expect(() => core_1.sanitizeInput(config)).toThrow("You must provide the repository option");
}));
test("No releaseTagName", () => __awaiter(void 0, void 0, void 0, function* () {
const config = {
githubToken: "aaa",
owner: "abc",
repository: "repo1/app1"
};
expect(() => core_1.sanitizeInput(config)).toThrow("You must provide the release tag option");
}));
test("No seed", () => __awaiter(void 0, void 0, void 0, function* () {
const config = {
githubToken: "aaa",
owner: "abc",
repository: "repo1/app1",
releaseTag: "v1"
};
expect(() => core_1.sanitizeInput(config)).toThrow("You must provide the seed option");
}));
test("Sanitized partial input", () => __awaiter(void 0, void 0, void 0, function* () {
const config = {
githubToken: "aaa",
owner: "abc",
repository: "repo1/app1",
releaseTag: "v1",
seed: "A".repeat(81)
};
expect(core_1.sanitizeInput(config)).toEqual({
githubToken: "aaa",
owner: "abc",
repository: "repo1/app1",
releaseTag: "v1",
addressIndex: 0,
node: "https://nodes.iota.cafe:443",
depth: 3,
mwm: 14,
explorerUrl: "https://utils.iota.org/transaction/:hash",
seed: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
transactionTag: "GITHUB9RELEASE",
comment: undefined
});
}));
test("Sanitized full input", () => __awaiter(void 0, void 0, void 0, function* () {
const config = {
githubToken: "aaa",
owner: "abc",
repository: "repo1/app1",
releaseTag: "v1",
seed: "A".repeat(81),
node: "https://foo",
depth: "1",
mwm: "2",
addressIndex: 10,
explorerUrl: "https://bar",
transactionTag: "TAGTAGTAG",
comment: "Mmmmm"
};
expect(core_1.sanitizeInput(config)).toEqual({
githubToken: "aaa",
owner: "abc",
repository: "repo1/app1",
releaseTag: "v1",
addressIndex: 10,
node: "https://foo",
depth: 1,
mwm: 2,
explorerUrl: "https://bar",
seed: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
transactionTag: "TAGTAGTAG",
comment: "Mmmmm"
});
}));
});
Loading

0 comments on commit 7b59dec

Please sign in to comment.