Skip to content

Commit

Permalink
Use built-in API (#14095)
Browse files Browse the repository at this point in the history
  • Loading branch information
woxtu authored Jul 2, 2024
1 parent eafae79 commit de1fe7c
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 73 deletions.
7 changes: 4 additions & 3 deletions packages/backend/test/e2e/move.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import { INestApplicationContext } from '@nestjs/common';

process.env.NODE_ENV = 'test';

import { setTimeout } from 'node:timers/promises';
import * as assert from 'assert';
import { loadConfig } from '@/config.js';
import { MiRepository, MiUser, UsersRepository, miRepository } from '@/models/_.js';
import { secureRndstr } from '@/misc/secure-rndstr.js';
import { jobQueue } from '@/boot/common.js';
import { api, initTestDb, signup, sleep, successfulApiCall, uploadFile } from '../utils.js';
import { api, initTestDb, signup, successfulApiCall, uploadFile } from '../utils.js';
import type * as misskey from 'misskey-js';

describe('Account Move', () => {
Expand Down Expand Up @@ -271,7 +272,7 @@ describe('Account Move', () => {

assert.strictEqual(move.status, 200);

await sleep(1000 * 3); // wait for jobs to finish
await setTimeout(1000 * 3); // wait for jobs to finish

// Unfollow delayed?
const aliceFollowings = await api('users/following', {
Expand Down Expand Up @@ -330,7 +331,7 @@ describe('Account Move', () => {
});

test('Unfollowed after 10 sec (24 hours in production).', async () => {
await sleep(1000 * 8);
await setTimeout(1000 * 8);

const following = await api('users/following', {
userId: alice.id,
Expand Down
9 changes: 5 additions & 4 deletions packages/backend/test/e2e/renote-mute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
process.env.NODE_ENV = 'test';

import * as assert from 'assert';
import { api, post, signup, sleep, waitFire } from '../utils.js';
import { setTimeout } from 'node:timers/promises';
import { api, post, signup, waitFire } from '../utils.js';
import type * as misskey from 'misskey-js';

describe('Renote Mute', () => {
Expand Down Expand Up @@ -35,7 +36,7 @@ describe('Renote Mute', () => {
const carolNote = await post(carol, { text: 'hi' });

// redisに追加されるのを待つ
await sleep(100);
await setTimeout(100);

const res = await api('notes/local-timeline', {}, alice);

Expand All @@ -52,7 +53,7 @@ describe('Renote Mute', () => {
const carolNote = await post(carol, { text: 'hi' });

// redisに追加されるのを待つ
await sleep(100);
await setTimeout(100);

const res = await api('notes/local-timeline', {}, alice);

Expand All @@ -69,7 +70,7 @@ describe('Renote Mute', () => {
const bobRenote = await post(bob, { renoteId: carolNote.id });

// redisに追加されるのを待つ
await sleep(100);
await setTimeout(100);

const res = await api('notes/local-timeline', {}, alice);

Expand Down
Loading

0 comments on commit de1fe7c

Please sign in to comment.