Files
fluxer/fluxer_api/src/api/channel/tests/DMCreationAllowedWithStrangers.test.ts
T

27 lines
951 B
TypeScript

// SPDX-License-Identifier: AGPL-3.0-or-later
import {afterAll, beforeAll, beforeEach, describe, expect, it} from 'vitest';
import {createTestAccount} from '../../auth/tests/AuthTestUtils';
import {type ApiTestHarness, createApiTestHarness} from '../../test/ApiTestHarness';
import {createDmChannel} from './ChannelTestUtils';
describe('DM creation allowed with strangers', () => {
let harness: ApiTestHarness;
beforeAll(async () => {
harness = await createApiTestHarness();
});
beforeEach(async () => {
await harness.reset();
});
afterAll(async () => {
await harness?.shutdown();
});
it('allows opening a DM with a stranger who shares no guild and is not a friend', async () => {
const user1 = await createTestAccount(harness);
const user2 = await createTestAccount(harness);
const dm = await createDmChannel(harness, user1.token, user2.userId);
expect(dm.id).toBeTruthy();
expect(dm.id.length).toBeGreaterThan(0);
});
});