Skip to content

Commit e5c480a

Browse files
authored
リファクタ (#26)
* refactor: Apply RSAPE * refactor: Move procs into run * refactor: Rename MockDB into MockUserDB * refactor: Tidy up mock classes * refactor: Move messageHandler into procs * refactor: Rename notify modules * fix: Apply renaming runner * lint: Remove disable-eslint * fix: Fix typo * refactor: Extract to local variable * fix: Use console.dir * fix: Refactor omit
1 parent 9d7fddd commit e5c480a

22 files changed

Lines changed: 87 additions & 89 deletions

exe/bot.ts

Lines changed: 0 additions & 52 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"license": "Apache-2.0",
88
"private": true,
99
"scripts": {
10-
"dev:bot": "ts-node ./exe/bot.ts",
11-
"build:bot": "esbuild --outfile=dist/bundle.js --sourcemap --bundle exe/bot.ts --platform=node --target=es2019 --external:discord.js --external:node-fetch",
10+
"dev:bot": "ts-node src/bot/run/release.ts",
11+
"build:bot": "esbuild --outfile=dist/bundle.js --sourcemap --bundle src/bot/run/release.ts --platform=node --target=es2019 --external:discord.js --external:node-fetch",
1212
"start:bot": "node dist/bundle.js",
1313
"dev:web": "next ./src/web",
1414
"build:web": "next build ./src/web",

src/bot/exp/omit.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ export const omitBody = (body: string): string => {
44
if (body.length < bodyWidth) {
55
return body;
66
}
7-
return `${body.slice(0, bodyWidth)}...`;
7+
const omitted = body.slice(0, bodyWidth);
8+
return `${omitted}...`;
89
};

src/bot/play/bring/branch.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { MessageEmbed } from "discord.js";
2-
import { MockMessage } from "../../skin/mock-message";
2+
import { MockMessage } from "../../skin/mock/message";
33
import { analectaForTest } from "../../skin/test-analecta";
44
import { bringBranch } from "./branch";
55
import { colorFromState } from "../../exp/state-color";

src/bot/play/bring/issue.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { MessageEmbed } from "discord.js";
2-
import { MockMessage } from "../../skin/mock-message";
2+
import { MockMessage } from "../../skin/mock/message";
33
import { analectaForTest } from "../../skin/test-analecta";
44
import { bringIssue } from "./issue";
55
import { colorFromState } from "../../exp/state-color";

src/bot/play/bring/pr.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { MessageEmbed } from "discord.js";
2-
import { MockMessage } from "../../skin/mock-message";
2+
import { MockMessage } from "../../skin/mock/message";
33
import { analectaForTest } from "../../skin/test-analecta";
44
import { bringPR } from "./pr";
55
import { colorFromState } from "../../exp/state-color";

src/bot/play/bring/repo.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { MessageEmbed } from "discord.js";
2-
import { MockMessage } from "../../skin/mock-message";
2+
import { MockMessage } from "../../skin/mock/message";
33
import { analectaForTest } from "../../skin/test-analecta";
44
import { bringRepo } from "./repo";
55

src/bot/play/error.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MockMessage } from "../skin/mock-message";
1+
import { MockMessage } from "../skin/mock/message";
22
import { analectaForTest } from "../skin/test-analecta";
33
import { error } from "./error";
44

src/bot/play/flavor.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MockMessage } from "../skin/mock-message";
1+
import { MockMessage } from "../skin/mock/message";
22
import { analectaForTest } from "../skin/test-analecta";
33
import { flavor } from "./flavor";
44

src/bot/play/subscribe/mark-as-read.test.ts renamed to src/bot/play/notify/mark-as-read.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { DiscordId } from "../../exp/discord-id";
22
import { GitHubUser } from "../../exp/github-user";
3-
import { MockDB } from "../../skin/mock-db";
4-
import { MockMessage } from "../../skin/mock-message";
3+
import { MockMessage } from "../../skin/mock/message";
4+
import { MockUserDB } from "../../skin/mock/user-db";
55
import { NotificationId } from "../../exp/github-notification";
66
import { analectaForTest } from "../../skin/test-analecta";
77
import { markAsRead } from "./mark-as-read";
88

99
test("mark a notification as read", async () => {
1010
const analecta = await analectaForTest();
11-
const db = new MockDB({
11+
const db = new MockUserDB({
1212
userName: "Alice",
1313
notificationToken: "TEST_TOKEN",
1414
currentNotificationIds: ["0123456789" as NotificationId],

0 commit comments

Comments
 (0)