mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 20:08:37 +00:00
refactor(server): use new storage providers (#5433)
This commit is contained in:
@@ -106,7 +106,11 @@ export async function setBlob(
|
||||
})
|
||||
)
|
||||
.field('map', JSON.stringify({ '0': ['variables.blob'] }))
|
||||
.attach('0', buffer, 'blob.data')
|
||||
.attach(
|
||||
'0',
|
||||
buffer,
|
||||
`blob-${Math.random().toString(16).substring(2, 10)}.data`
|
||||
)
|
||||
.expect(200);
|
||||
return res.body.data.setBlob;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import { randomUUID } from 'node:crypto';
|
||||
|
||||
import type { DynamicModule, FactoryProvider } from '@nestjs/common';
|
||||
import { TestingModule } from '@nestjs/testing';
|
||||
import { hashSync } from '@node-rs/argon2';
|
||||
import { PrismaClient, type User } from '@prisma/client';
|
||||
|
||||
import { RevertCommand, RunCommand } from '../../src/data/commands/run';
|
||||
import { StorageProvide } from '../../src/storage';
|
||||
|
||||
export async function flushDB() {
|
||||
const client = new PrismaClient();
|
||||
@@ -56,24 +54,6 @@ export class FakePrisma {
|
||||
}
|
||||
}
|
||||
|
||||
export class FakeStorageModule {
|
||||
static forRoot(): DynamicModule {
|
||||
const storageProvider: FactoryProvider = {
|
||||
provide: StorageProvide,
|
||||
useFactory: async () => {
|
||||
return null;
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
global: true,
|
||||
module: FakeStorageModule,
|
||||
providers: [storageProvider],
|
||||
exports: [storageProvider],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function initFeatureConfigs(module: TestingModule) {
|
||||
const run = module.get(RunCommand);
|
||||
const revert = module.get(RevertCommand);
|
||||
|
||||
Reference in New Issue
Block a user