This commit is contained in:
syuilo 2023-09-05 17:02:14 +09:00
parent 2630513c83
commit 1beaac8e2d
6 changed files with 51 additions and 51 deletions

View file

@ -17,7 +17,7 @@ import { PushNotificationService } from '@/core/PushNotificationService.js';
import { NotificationEntityService } from '@/core/entities/NotificationEntityService.js'; import { NotificationEntityService } from '@/core/entities/NotificationEntityService.js';
import { IdService } from '@/core/IdService.js'; import { IdService } from '@/core/IdService.js';
import { CacheService } from '@/core/CacheService.js'; import { CacheService } from '@/core/CacheService.js';
import { Config } from '@/config.js'; import type { Config } from '@/config.js';
@Injectable() @Injectable()
export class NotificationService implements OnApplicationShutdown { export class NotificationService implements OnApplicationShutdown {

View file

@ -10,8 +10,8 @@ import { UploadPartCommand, CompleteMultipartUploadCommand, CreateMultipartUploa
import { mockClient } from 'aws-sdk-client-mock'; import { mockClient } from 'aws-sdk-client-mock';
import { GlobalModule } from '@/GlobalModule.js'; import { GlobalModule } from '@/GlobalModule.js';
import { CoreModule } from '@/core/CoreModule.js'; import { CoreModule } from '@/core/CoreModule.js';
import { S3Service } from '@/core/S3Service'; import { S3Service } from '@/core/S3Service.js';
import { Meta } from '@/models'; import { MiMeta } from '@/models/index.js';
import type { TestingModule } from '@nestjs/testing'; import type { TestingModule } from '@nestjs/testing';
describe('S3Service', () => { describe('S3Service', () => {
@ -40,7 +40,7 @@ describe('S3Service', () => {
test('upload a file', async () => { test('upload a file', async () => {
s3Mock.on(PutObjectCommand).resolves({}); s3Mock.on(PutObjectCommand).resolves({});
await s3Service.upload({ objectStorageRegion: 'us-east-1' } as Meta, { await s3Service.upload({ objectStorageRegion: 'us-east-1' } as MiMeta, {
Bucket: 'fake', Bucket: 'fake',
Key: 'fake', Key: 'fake',
Body: 'x', Body: 'x',
@ -52,7 +52,7 @@ describe('S3Service', () => {
s3Mock.on(UploadPartCommand).resolves({ ETag: '1' }); s3Mock.on(UploadPartCommand).resolves({ ETag: '1' });
s3Mock.on(CompleteMultipartUploadCommand).resolves({ Bucket: 'fake', Key: 'fake' }); s3Mock.on(CompleteMultipartUploadCommand).resolves({ Bucket: 'fake', Key: 'fake' });
await s3Service.upload({} as Meta, { await s3Service.upload({} as MiMeta, {
Bucket: 'fake', Bucket: 'fake',
Key: 'fake', Key: 'fake',
Body: 'x'.repeat(8 * 1024 * 1024 + 1), // デフォルトpartSizeにしている 8 * 1024 * 1024 を越えるサイズ Body: 'x'.repeat(8 * 1024 * 1024 + 1), // デフォルトpartSizeにしている 8 * 1024 * 1024 を越えるサイズ
@ -62,7 +62,7 @@ describe('S3Service', () => {
test('upload a file error', async () => { test('upload a file error', async () => {
s3Mock.on(PutObjectCommand).rejects({ name: 'Fake Error' }); s3Mock.on(PutObjectCommand).rejects({ name: 'Fake Error' });
await expect(s3Service.upload({ objectStorageRegion: 'us-east-1' } as Meta, { await expect(s3Service.upload({ objectStorageRegion: 'us-east-1' } as MiMeta, {
Bucket: 'fake', Bucket: 'fake',
Key: 'fake', Key: 'fake',
Body: 'x', Body: 'x',
@ -72,7 +72,7 @@ describe('S3Service', () => {
test('upload a large file error', async () => { test('upload a large file error', async () => {
s3Mock.on(UploadPartCommand).rejects(); s3Mock.on(UploadPartCommand).rejects();
await expect(s3Service.upload({} as Meta, { await expect(s3Service.upload({} as MiMeta, {
Bucket: 'fake', Bucket: 'fake',
Key: 'fake', Key: 'fake',
Body: 'x'.repeat(8 * 1024 * 1024 + 1), // デフォルトpartSizeにしている 8 * 1024 * 1024 を越えるサイズ Body: 'x'.repeat(8 * 1024 * 1024 + 1), // デフォルトpartSizeにしている 8 * 1024 * 1024 を越えるサイズ

View file

@ -18,11 +18,11 @@ import { CoreModule } from '@/core/CoreModule.js';
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js'; import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
import { LoggerService } from '@/core/LoggerService.js'; import { LoggerService } from '@/core/LoggerService.js';
import type { IActor, IApDocument, ICollection, IPost } from '@/core/activitypub/type.js'; import type { IActor, IApDocument, ICollection, IPost } from '@/core/activitypub/type.js';
import { Meta, Note } from '@/models/index.js'; import { MiMeta, MiNote } from '@/models/index.js';
import { secureRndstr } from '@/misc/secure-rndstr.js'; import { secureRndstr } from '@/misc/secure-rndstr.js';
import { DownloadService } from '@/core/DownloadService.js'; import { DownloadService } from '@/core/DownloadService.js';
import { MetaService } from '@/core/MetaService.js'; import { MetaService } from '@/core/MetaService.js';
import type { RemoteUser } from '@/models/entities/User.js'; import type { MiRemoteUser } from '@/models/entities/User.js';
import { MockResolver } from '../misc/mock-resolver.js'; import { MockResolver } from '../misc/mock-resolver.js';
const host = 'https://host1.test'; const host = 'https://host1.test';
@ -75,7 +75,7 @@ function createRandomFeaturedCollection(actor: NonTransientIActor, length: numbe
async function createRandomRemoteUser( async function createRandomRemoteUser(
resolver: MockResolver, resolver: MockResolver,
personService: ApPersonService, personService: ApPersonService,
): Promise<RemoteUser> { ): Promise<MiRemoteUser> {
const actor = createRandomActor(); const actor = createRandomActor();
resolver.register(actor.id, actor); resolver.register(actor.id, actor);
@ -94,7 +94,7 @@ describe('ActivityPub', () => {
cacheRemoteSensitiveFiles: true, cacheRemoteSensitiveFiles: true,
blockedHosts: [] as string[], blockedHosts: [] as string[],
sensitiveWords: [] as string[], sensitiveWords: [] as string[],
} as Meta; } as MiMeta;
let meta = metaInitial; let meta = metaInitial;
beforeAll(async () => { beforeAll(async () => {
@ -109,7 +109,7 @@ describe('ActivityPub', () => {
}, },
}) })
.overrideProvider(MetaService).useValue({ .overrideProvider(MetaService).useValue({
async fetch(): Promise<Meta> { async fetch(): Promise<MiMeta> {
return meta; return meta;
}, },
}).compile(); }).compile();
@ -199,7 +199,7 @@ describe('ActivityPub', () => {
rendererService.renderAnnounce(null, { rendererService.renderAnnounce(null, {
createdAt: new Date(0), createdAt: new Date(0),
visibility: 'followers', visibility: 'followers',
} as Note); } as MiNote);
}); });
}); });

View file

@ -18,7 +18,7 @@ import { entity as TestGroupedChartEntity } from '@/core/chart/charts/entities/t
import { entity as TestUniqueChartEntity } from '@/core/chart/charts/entities/test-unique.js'; import { entity as TestUniqueChartEntity } from '@/core/chart/charts/entities/test-unique.js';
import { entity as TestIntersectionChartEntity } from '@/core/chart/charts/entities/test-intersection.js'; import { entity as TestIntersectionChartEntity } from '@/core/chart/charts/entities/test-intersection.js';
import { loadConfig } from '@/config.js'; import { loadConfig } from '@/config.js';
import type { AppLockService } from '@/core/AppLockService'; import type { AppLockService } from '@/core/AppLockService.js';
import Logger from '@/logger.js'; import Logger from '@/logger.js';
describe('Chart', () => { describe('Chart', () => {

View file

@ -8,7 +8,7 @@ import { readFile } from 'node:fs/promises';
import { isAbsolute, basename } from 'node:path'; import { isAbsolute, basename } from 'node:path';
import { inspect } from 'node:util'; import { inspect } from 'node:util';
import WebSocket, { ClientOptions } from 'ws'; import WebSocket, { ClientOptions } from 'ws';
import fetch, { Blob, File, RequestInit } from 'node-fetch'; import fetch, { File, RequestInit } from 'node-fetch';
import { DataSource } from 'typeorm'; import { DataSource } from 'typeorm';
import { JSDOM } from 'jsdom'; import { JSDOM } from 'jsdom';
import { DEFAULT_POLICIES } from '@/core/RoleService.js'; import { DEFAULT_POLICIES } from '@/core/RoleService.js';