<commit_before>/* eslint-env node, jest */

jest.mock('../achievements/index.ts');

const ahokusa = require('./index.js');
const Slack = require('../lib/slackMock.js');

let slack = null;

beforeEach(() => {
	slack = new Slack();
	process.env.CHANNEL_SANDBOX = slack.fakeChannel;
	ahokusa(slack);
});

describe('ahokusa', () => {
	it('responds to あほくさスライドパズル', async () => {
		const {text, username} = await slack.getResponseTo('あほくさスライドパズル');

		expect(username).toBe('ahokusa');
		expect(text).toContain(':void:');
		expect(text).toMatch(/^(:[a-z-]+:\n?){6}$/);
	});

	it('accepts valid board initialization by emojis', async () => {
		const board = [
			':void::ahokusa-bottom-center::ahokusa-top-center:',
			':ahokusa-bottom-left::ahokusa-top-left::ahokusa-top-right:',
		].join('\n');

		const {text, username} = await slack.getResponseTo(`@ahokusa ${board}`);

		expect(username).toBe('ahokusa');
		expect(text).toBe(board);<commit_msg>mock wo '../achievements' ni shita<commit_after>/* eslint-env node, jest */

jest.mock('../achievements');

const ahokusa = require('./index.js');
const Slack = require('../lib/slackMock.js');

let slack = null;

beforeEach(() => {
	slack = new Slack();
	process.env.CHANNEL_SANDBOX = slack.fakeChannel;
	ahokusa(slack);
});

describe('ahokusa', () => {
	it('responds to あほくさスライドパズル', async () => {
		const {text, username} = await slack.getResponseTo('あほくさスライドパズル');

		expect(username).toBe('ahokusa');
		expect(text).toContain(':void:');
		expect(text).toMatch(/^(:[a-z-]+:\n?){6}$/);
	});

	it('accepts valid board initialization by emojis', async () => {
		const board = [
			':void::ahokusa-bottom-center::ahokusa-top-center:',
			':ahokusa-bottom-left::ahokusa-top-left::ahokusa-top-right:',
		].join('\n');

		const {text, username} = await slack.getResponseTo(`@ahokusa ${board}`);

		expect(username).toBe('ahokusa');
		expect(text).toBe(board);
{'fraction_non_alphanumeric': 0.22286617492096944, 'fraction_numerical': 0.001053740779768177, 'mean_word_length': 4.861111111111111, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3670373', 'n_tokens_mistral': 768, 'n_tokens_neox': 721, 'n_words': 111}