Skip to content

Commit

Permalink
feat: 人は話し方が9割ジェネレーターの追加 (#648)
Browse files Browse the repository at this point in the history
  • Loading branch information
m2en authored Dec 24, 2022
1 parent 2653b0a commit 8cbe9cf
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/service/command/meme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { lolicon } from './lolicon.js';
import { moeta } from './moeta.js';
import { n } from './n.js';
import { nigetane } from './nigetane.js';
import { nine } from './nine.js';
import { ojaru } from './ojaru.js';
import { takopi } from './takopi.js';
import { web3 } from './web3.js';
Expand All @@ -21,5 +22,6 @@ export const memes = [
moeta,
kenjou,
koume,
ojaru
ojaru,
nine
];
13 changes: 13 additions & 0 deletions src/service/command/meme/nine.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 nine: MemeTemplate<never, never> = {
commandNames: ['nine'],
description: '〇〇は〇〇が9割',
flagsKeys: [],
optionsKeys: [],
errorMessage: '人は引数ミスが9割',
generate(args) {
const [option1, option2] = args.body.split(' ');
return `${option1}${option2}が9割`;
}
};
4 changes: 4 additions & 0 deletions src/service/command/meme/test/dousurya.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ describe('meme', () => {
const responder = new Meme();

it('use case of dousurya', async () => {
/**
* !dousurya と !dousureba のテストケースです。
* 一見同じように見えるが、違うので重複してたからと削除しないよう注意してほしい
*/
await responder.on(
createMockMessage(
parseStringsOrThrow(['dousurya', 'こるく'], responder.schema),
Expand Down
36 changes: 36 additions & 0 deletions src/service/command/meme/test/nine.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { describe, expect, it } from 'vitest';
import { Meme } from '../../meme.js';

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

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

it('use case of nine', async () => {
await responder.on(
createMockMessage(
parseStringsOrThrow(['nine', '限界開発鯖', 'オタク'], responder.schema),
(message) => {
expect(message).toStrictEqual({
description: `限界開発鯖はオタクが9割`
});
}
)
);
});

it('args null (nine)', async () => {
await responder.on(
createMockMessage(
parseStringsOrThrow(['nine'], responder.schema),
(message) => {
expect(message).toStrictEqual({
description: '人は引数ミスが9割',
title: '引数が不足してるみたいだ。'
});
}
)
);
});
});

0 comments on commit 8cbe9cf

Please sign in to comment.