mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-07-27 11:44:35 +02:00
* test(e2e): フォロー中のチャンネルに再度フォローAPIを叩いた場合のテストを追加 * fix(backend): フォロー中のチャンネルを再度フォローした際にALREADY_FOLLOWINGエラーを返すように * docs(changelog): update changelog
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
process.env.NODE_ENV = 'test';
|
|
|
|
import * as assert from 'assert';
|
|
import { describe, beforeAll, test } from 'vitest';
|
|
import { api, castAsError, signup } from '../utils.js';
|
|
import type * as misskey from 'misskey-js';
|
|
|
|
describe('Channel', () => {
|
|
let alice: misskey.entities.SignupResponse;
|
|
beforeAll(async () => {
|
|
alice = await signup({ username: 'alice' });
|
|
});
|
|
|
|
describe('Follow', () => {
|
|
let channel: misskey.entities.ChannelsCreateResponse;
|
|
|
|
beforeAll(async () => {
|
|
const res = await api('channels/create', { name: 'follow-test-channel' }, alice);
|
|
channel = res.body;
|
|
});
|
|
|
|
test('フォローしているチャンネルを再度フォローするとALREADY_FOLLOWINGエラーになる', async () => {
|
|
const res1 = await api('channels/follow', { channelId: channel.id }, alice);
|
|
assert.strictEqual(res1.status, 204);
|
|
|
|
const res2 = await api('channels/follow', { channelId: channel.id }, alice);
|
|
assert.strictEqual(res2.status, 400);
|
|
assert.strictEqual(castAsError(res2.body as any).error.code, 'ALREADY_FOLLOWING');
|
|
});
|
|
});
|
|
});
|