refactor(server): use feature model (#9932)

This commit is contained in:
forehalo
2025-02-05 10:27:26 +00:00
parent 0ff8d3af6f
commit 7826e2b7c8
121 changed files with 1723 additions and 3826 deletions
@@ -1,4 +1,3 @@
import { TestingModule } from '@nestjs/testing';
import type { Snapshot } from '@prisma/client';
import { PrismaClient } from '@prisma/client';
import test from 'ava';
@@ -7,7 +6,7 @@ import * as Sinon from 'sinon';
import { DocStorageModule, PgWorkspaceDocStorageAdapter } from '../../core/doc';
import { DocStorageOptions } from '../../core/doc/options';
import { DocRecord } from '../../core/doc/storage';
import { createTestingModule, initTestingDB } from '../utils';
import { createTestingModule, type TestingModule } from '../utils';
let m: TestingModule;
let adapter: PgWorkspaceDocStorageAdapter;
@@ -24,7 +23,7 @@ test.before(async () => {
});
test.beforeEach(async () => {
await initTestingDB(db);
await m.initTestingDB();
const options = m.get(DocStorageOptions);
Sinon.stub(options, 'historyMaxAge').resolves(1000);
});
@@ -75,7 +75,8 @@ test('should render correct html', async t => {
);
});
test('should render correct mobile html', async t => {
// TODO(@forehalo): enable it when mobile version is ready
test.skip('should render correct mobile html', async t => {
const res = await request(t.context.app.getHttpServer())
.get('/workspace/xxxx/xxx')
.set('user-agent', mobileUAString)
@@ -1,4 +1,3 @@
import { TestingModule } from '@nestjs/testing';
import { PrismaClient } from '@prisma/client';
import test from 'ava';
import * as Sinon from 'sinon';
@@ -9,7 +8,7 @@ import {
DocStorageModule,
PgWorkspaceDocStorageAdapter as Adapter,
} from '../../core/doc';
import { createTestingModule, initTestingDB } from '../utils';
import { createTestingModule, type TestingModule } from '../utils';
let m: TestingModule;
let db: PrismaClient;
@@ -35,7 +34,7 @@ test.before('init testing module', async () => {
});
test.beforeEach(async () => {
await initTestingDB(db);
await m.initTestingDB();
});
test.after.always(async () => {