Skip to content
This repository has been archived by the owner on Apr 19, 2020. It is now read-only.

Commit

Permalink
create message.spec.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
selmertsx committed May 18, 2018
1 parent 7434128 commit e930cb3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
5 changes: 4 additions & 1 deletion __tests__/issuer.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { Issuer } from "../src/issuer";

describe("Issuer", () => {
test("authenticate", async () => {
// This test was created for debugging issuer.ts
test("create issue", async () => {
/*
const issuer = new Issuer("selmertsx", "study");
await issuer.authenticate();
const response = await issuer.create("sample");
*/
});
});
16 changes: 16 additions & 0 deletions __tests__/message.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import * as fs from "fs";
import { Message } from "../src/message";

const response = JSON.parse(
fs.readFileSync("./__mocks__/create_issue_response.json", "utf8")
);

describe("Message", () => {
test("attachment", async () => {
const message = new Message(response);
expect(message.attachments()).toEqual({
title: "sample",
title_link: "https://github.com/selmertsx/study/issues/1"
});
});
});
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,5 @@ export async function handler(
const client = new SlackClient(payload.event.channel);
const message = new Message(response);
await client.postMessage(message.text(), message.attachments());

return buildResponse(200);
}

0 comments on commit e930cb3

Please sign in to comment.