-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
m2en
authored
Dec 24, 2022
1 parent
2653b0a
commit 8cbe9cf
Showing
4 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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割`; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: '引数が不足してるみたいだ。' | ||
}); | ||
} | ||
) | ||
); | ||
}); | ||
}); |