Compare commits

...

2 Commits

Author SHA1 Message Date
syuilo 73f8a536ac Update activitypub.ts 2025-05-28 21:10:20 +09:00
syuilo cb7d9f666b Update activitypub.ts 2025-05-28 19:50:46 +09:00
1 changed files with 7 additions and 2 deletions

View File

@ -7,6 +7,8 @@ process.env.NODE_ENV = 'test';
import * as assert from 'assert';
import * as fs from 'node:fs';
import { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';
import { Test } from '@nestjs/testing';
import { jest } from '@jest/globals';
@ -29,6 +31,9 @@ import { secureRndstr } from '@/misc/secure-rndstr.js';
import { DownloadService } from '@/core/DownloadService.js';
import { genAidx } from '@/misc/id/aidx.js';
const _filename = fileURLToPath(import.meta.url);
const _dirname = dirname(_filename);
const host = 'https://host1.test';
type NonTransientIActor = IActor & { id: string };
@ -121,10 +126,10 @@ describe('ActivityPub', () => {
imports: [GlobalModule, CoreModule],
})
.overrideProvider(DownloadService).useValue({
async downloadUrl(url, path): Promise<{ filename: string }> {
async downloadUrl(url: string, path: string): Promise<{ filename: string }> {
if (url.endsWith('.png')) {
fs.copyFileSync(
`${__dirname}/../resources/hw.png`,
_dirname + '/../resources/hw.png',
path,
);
}