Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: コンピューターの天才、9つのC言語を操る のMEMEを追加 #712

Merged
merged 5 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/service/command/meme/clang.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { MemeTemplate } from '../../../model/meme-template.js';

export const clang: MemeTemplate<never, never> = {
commandNames: ['clang', 'c'],
description: '〜の天才\n9つの〜を操る',
flagsKeys: [],
optionsKeys: [],
errorMessage: 'エラーの天才\n9つの引数エラーを操る',
generate(args) {
const [option1, option2] = args.body.split(' ');
return `${option1}の天才\n9つの${option2}を操る`;
}
};
4 changes: 3 additions & 1 deletion src/service/command/meme/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { clang } from './clang.js';
import { dousurya } from './dousurya.js';
import { hukueki } from './hukueki.js';
import { kenjou } from './kenjou.js';
Expand Down Expand Up @@ -25,5 +26,6 @@ export const memes = [
koume,
ojaru,
nine,
tsureteike
tsureteike,
clang
];
36 changes: 36 additions & 0 deletions src/service/command/meme/test/clang.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { describe, expect, it } from 'vitest';

import { parseStringsOrThrow } from '../../../../adaptor/proxy/command/schema.js';
import { createMockMessage } from '../../command-message.js';
import { Meme } from '../../meme.js';

describe('meme', () => {
const responder = new Meme();

it('use case of clang', async () => {
await responder.on(
createMockMessage(
parseStringsOrThrow(['clang', 'GitHub', 'ラベル'], responder.schema),
(message) => {
expect(message).toStrictEqual({
description: 'GitHubの天才\n9つのラベルを操る'
});
}
)
);
});

it('args null (clang)', async () => {
await responder.on(
createMockMessage(
parseStringsOrThrow(['clang'], responder.schema),
(message) => {
expect(message).toStrictEqual({
title: '引数が不足してるみたいだ。',
description: 'エラーの天才\n9つの引数エラーを操る'
});
}
)
);
});
});