Use built-in API (#14095)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
process.env.NODE_ENV = 'test';
|
||||
|
||||
import { setTimeout } from 'node:timers/promises';
|
||||
import { jest } from '@jest/globals';
|
||||
import { ModuleMocker } from 'jest-mock';
|
||||
import { Test } from '@nestjs/testing';
|
||||
@@ -29,7 +30,6 @@ import { secureRndstr } from '@/misc/secure-rndstr.js';
|
||||
import { NotificationService } from '@/core/NotificationService.js';
|
||||
import { RoleCondFormulaValue } from '@/models/Role.js';
|
||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
import { sleep } from '../utils.js';
|
||||
import type { TestingModule } from '@nestjs/testing';
|
||||
import type { MockFunctionMetadata } from 'jest-mock';
|
||||
|
||||
@@ -278,7 +278,7 @@ describe('RoleService', () => {
|
||||
|
||||
// ストリーミング経由で反映されるまでちょっと待つ
|
||||
clock.uninstall();
|
||||
await sleep(100);
|
||||
await setTimeout(100);
|
||||
|
||||
const resultAfter25hAgain = await roleService.getUserPolicies(user.id);
|
||||
expect(resultAfter25hAgain.canManageCustomEmojis).toBe(true);
|
||||
@@ -807,7 +807,7 @@ describe('RoleService', () => {
|
||||
await roleService.assign(user.id, role.id);
|
||||
|
||||
clock.uninstall();
|
||||
await sleep(100);
|
||||
await setTimeout(100);
|
||||
|
||||
const assignments = await roleAssignmentsRepository.find({
|
||||
where: {
|
||||
@@ -835,7 +835,7 @@ describe('RoleService', () => {
|
||||
await roleService.assign(user.id, role.id);
|
||||
|
||||
clock.uninstall();
|
||||
await sleep(100);
|
||||
await setTimeout(100);
|
||||
|
||||
const assignments = await roleAssignmentsRepository.find({
|
||||
where: {
|
||||
|
@@ -3,6 +3,7 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { setTimeout } from 'node:timers/promises';
|
||||
import { afterEach, beforeEach, describe, expect, jest } from '@jest/globals';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { MiUser } from '@/models/User.js';
|
||||
@@ -16,7 +17,7 @@ import { DI } from '@/di-symbols.js';
|
||||
import { QueueService } from '@/core/QueueService.js';
|
||||
import { LoggerService } from '@/core/LoggerService.js';
|
||||
import { SystemWebhookService } from '@/core/SystemWebhookService.js';
|
||||
import { randomString, sleep } from '../utils.js';
|
||||
import { randomString } from '../utils.js';
|
||||
|
||||
describe('SystemWebhookService', () => {
|
||||
let app: TestingModule;
|
||||
@@ -358,7 +359,7 @@ describe('SystemWebhookService', () => {
|
||||
);
|
||||
|
||||
// redisでの配信経由で更新されるのでちょっと待つ
|
||||
await sleep(500);
|
||||
await setTimeout(500);
|
||||
|
||||
const fetchedWebhooks = await service.fetchActiveSystemWebhooks();
|
||||
expect(fetchedWebhooks).toEqual([webhook]);
|
||||
@@ -377,7 +378,7 @@ describe('SystemWebhookService', () => {
|
||||
);
|
||||
|
||||
// redisでの配信経由で更新されるのでちょっと待つ
|
||||
await sleep(500);
|
||||
await setTimeout(500);
|
||||
|
||||
const fetchedWebhooks = await service.fetchActiveSystemWebhooks();
|
||||
expect(fetchedWebhooks).toEqual([]);
|
||||
@@ -407,7 +408,7 @@ describe('SystemWebhookService', () => {
|
||||
);
|
||||
|
||||
// redisでの配信経由で更新されるのでちょっと待つ
|
||||
await sleep(500);
|
||||
await setTimeout(500);
|
||||
|
||||
const fetchedWebhooks = await service.fetchActiveSystemWebhooks();
|
||||
expect(fetchedWebhooks).toEqual([webhook2]);
|
||||
@@ -434,7 +435,7 @@ describe('SystemWebhookService', () => {
|
||||
);
|
||||
|
||||
// redisでの配信経由で更新されるのでちょっと待つ
|
||||
await sleep(500);
|
||||
await setTimeout(500);
|
||||
|
||||
const fetchedWebhooks = await service.fetchActiveSystemWebhooks();
|
||||
expect(fetchedWebhooks.length).toEqual(0);
|
||||
@@ -457,7 +458,7 @@ describe('SystemWebhookService', () => {
|
||||
);
|
||||
|
||||
// redisでの配信経由で更新されるのでちょっと待つ
|
||||
await sleep(500);
|
||||
await setTimeout(500);
|
||||
|
||||
const fetchedWebhooks = await service.fetchActiveSystemWebhooks();
|
||||
expect(fetchedWebhooks).toEqual([webhook2]);
|
||||
@@ -481,7 +482,7 @@ describe('SystemWebhookService', () => {
|
||||
);
|
||||
|
||||
// redisでの配信経由で更新されるのでちょっと待つ
|
||||
await sleep(500);
|
||||
await setTimeout(500);
|
||||
|
||||
const fetchedWebhooks = await service.fetchActiveSystemWebhooks();
|
||||
expect(fetchedWebhooks.length).toEqual(0);
|
||||
@@ -504,7 +505,7 @@ describe('SystemWebhookService', () => {
|
||||
);
|
||||
|
||||
// redisでの配信経由で更新されるのでちょっと待つ
|
||||
await sleep(500);
|
||||
await setTimeout(500);
|
||||
|
||||
const fetchedWebhooks = await service.fetchActiveSystemWebhooks();
|
||||
expect(fetchedWebhooks.length).toEqual(0);
|
||||
|
Reference in New Issue
Block a user