mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
chore(server): move server tests folder (#9614)
This commit is contained in:
@@ -11,9 +11,9 @@
|
||||
"build": "tsc",
|
||||
"dev": "nodemon ./src/index.ts",
|
||||
"test": "ava --concurrency 1 --serial",
|
||||
"test:copilot": "ava \"tests/**/copilot-*.spec.ts\"",
|
||||
"test:copilot": "ava \"src/__tests__/**/copilot-*.spec.ts\"",
|
||||
"test:coverage": "c8 ava --concurrency 1 --serial",
|
||||
"test:copilot:coverage": "c8 ava --timeout=5m \"tests/**/copilot-*.spec.ts\"",
|
||||
"test:copilot:coverage": "c8 ava --timeout=5m \"src/__tests__/**/copilot-*.spec.ts\"",
|
||||
"data-migration": "cross-env NODE_ENV=script r ./src/data/index.ts",
|
||||
"predeploy": "yarn prisma migrate deploy && NODE_ENV=script node --import ./scripts/register.js ./dist/data/index.js run",
|
||||
"postinstall": "prisma generate"
|
||||
@@ -96,6 +96,7 @@
|
||||
"devDependencies": {
|
||||
"@affine-test/kit": "workspace:*",
|
||||
"@affine-tools/cli": "workspace:*",
|
||||
"@affine-tools/utils": "workspace:*",
|
||||
"@affine/server-native": "workspace:*",
|
||||
"@nestjs/testing": "^10.4.15",
|
||||
"@types/cookie-parser": "^1.4.8",
|
||||
@@ -134,8 +135,7 @@
|
||||
},
|
||||
"files": [
|
||||
"**/__tests__/**/*.spec.ts",
|
||||
"tests/**/*.spec.ts",
|
||||
"tests/**/*.e2e.ts"
|
||||
"**/__tests__/**/*.e2e.ts"
|
||||
],
|
||||
"require": [
|
||||
"./src/prelude.ts"
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { TestFn } from 'ava';
|
||||
import ava from 'ava';
|
||||
import request from 'supertest';
|
||||
|
||||
import { buildAppModule } from '../../src/app.module';
|
||||
import { buildAppModule } from '../../app.module';
|
||||
import { createTestingApp } from '../utils';
|
||||
|
||||
const gql = '/graphql';
|
||||
@@ -3,7 +3,7 @@ import type { TestFn } from 'ava';
|
||||
import ava from 'ava';
|
||||
import request from 'supertest';
|
||||
|
||||
import { buildAppModule } from '../../src/app.module';
|
||||
import { buildAppModule } from '../../app.module';
|
||||
import { createTestingApp } from '../utils';
|
||||
|
||||
const test = ava as TestFn<{
|
||||
@@ -7,9 +7,9 @@ import type { TestFn } from 'ava';
|
||||
import ava from 'ava';
|
||||
import request from 'supertest';
|
||||
|
||||
import { buildAppModule } from '../../src/app.module';
|
||||
import { Config } from '../../src/base';
|
||||
import { ServerService } from '../../src/core/config';
|
||||
import { buildAppModule } from '../../app.module';
|
||||
import { Config } from '../../base';
|
||||
import { ServerService } from '../../core/config';
|
||||
import { createTestingApp, initTestingDB } from '../utils';
|
||||
|
||||
const test = ava as TestFn<{
|
||||
@@ -3,7 +3,7 @@ import type { TestFn } from 'ava';
|
||||
import ava from 'ava';
|
||||
import request from 'supertest';
|
||||
|
||||
import { buildAppModule } from '../../src/app.module';
|
||||
import { buildAppModule } from '../../app.module';
|
||||
import { createTestingApp } from '../utils';
|
||||
|
||||
const test = ava as TestFn<{
|
||||
@@ -8,8 +8,8 @@ import type { INestApplication } from '@nestjs/common';
|
||||
import type { TestFn } from 'ava';
|
||||
import ava from 'ava';
|
||||
|
||||
import { MailService } from '../../src/base/mailer';
|
||||
import { AuthService } from '../../src/core/auth/service';
|
||||
import { MailService } from '../../base/mailer';
|
||||
import { AuthService } from '../../core/auth/service';
|
||||
import {
|
||||
changeEmail,
|
||||
changePassword,
|
||||
@@ -4,11 +4,11 @@ import ava, { TestFn } from 'ava';
|
||||
import Sinon from 'sinon';
|
||||
import request from 'supertest';
|
||||
|
||||
import { MailService } from '../../src/base';
|
||||
import { AuthModule, CurrentUser } from '../../src/core/auth';
|
||||
import { AuthService } from '../../src/core/auth/service';
|
||||
import { FeatureModule } from '../../src/core/features';
|
||||
import { UserModule, UserService } from '../../src/core/user';
|
||||
import { MailService } from '../../base';
|
||||
import { AuthModule, CurrentUser } from '../../core/auth';
|
||||
import { AuthService } from '../../core/auth/service';
|
||||
import { FeatureModule } from '../../core/features';
|
||||
import { UserModule, UserService } from '../../core/user';
|
||||
import { createTestingApp, getSession, sessionCookie } from '../utils';
|
||||
|
||||
const test = ava as TestFn<{
|
||||
@@ -4,8 +4,8 @@ import ava, { TestFn } from 'ava';
|
||||
import Sinon from 'sinon';
|
||||
import request from 'supertest';
|
||||
|
||||
import { AuthModule, CurrentUser, Public, Session } from '../../src/core/auth';
|
||||
import { AuthService } from '../../src/core/auth/service';
|
||||
import { AuthModule, CurrentUser, Public, Session } from '../../core/auth';
|
||||
import { AuthService } from '../../core/auth/service';
|
||||
import { createTestingApp } from '../utils';
|
||||
|
||||
@Controller('/')
|
||||
@@ -2,11 +2,11 @@ import { TestingModule } from '@nestjs/testing';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import ava, { TestFn } from 'ava';
|
||||
|
||||
import { CurrentUser } from '../../src/core/auth';
|
||||
import { AuthService } from '../../src/core/auth/service';
|
||||
import { FeatureModule } from '../../src/core/features';
|
||||
import { QuotaModule } from '../../src/core/quota';
|
||||
import { UserModule, UserService } from '../../src/core/user';
|
||||
import { CurrentUser } from '../../core/auth';
|
||||
import { AuthService } from '../../core/auth/service';
|
||||
import { FeatureModule } from '../../core/features';
|
||||
import { QuotaModule } from '../../core/quota';
|
||||
import { UserModule, UserService } from '../../core/user';
|
||||
import { createTestingModule, initTestingDB } from '../utils';
|
||||
|
||||
const test = ava as TestFn<{
|
||||
@@ -2,7 +2,7 @@ import { TestingModule } from '@nestjs/testing';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import ava, { TestFn } from 'ava';
|
||||
|
||||
import { TokenService, TokenType } from '../../src/core/auth';
|
||||
import { TokenService, TokenType } from '../../core/auth';
|
||||
import { createTestingModule } from '../utils';
|
||||
|
||||
const test = ava as TestFn<{
|
||||
@@ -1,7 +1,7 @@
|
||||
import { TestingModule } from '@nestjs/testing';
|
||||
import test from 'ava';
|
||||
|
||||
import { Cache } from '../src/base/cache';
|
||||
import { Cache } from '../base/cache';
|
||||
import { createTestingModule } from './utils';
|
||||
|
||||
let cache: Cache;
|
||||
@@ -1,7 +1,7 @@
|
||||
import { TestingModule } from '@nestjs/testing';
|
||||
import test from 'ava';
|
||||
|
||||
import { Config, ConfigModule } from '../src/base/config';
|
||||
import { Config, ConfigModule } from '../base/config';
|
||||
import { createTestingModule } from './utils';
|
||||
|
||||
let config: Config;
|
||||
@@ -1,14 +1,14 @@
|
||||
/// <reference types="../src/global.d.ts" />
|
||||
/// <reference types="../global.d.ts" />
|
||||
|
||||
import { TestingModule } from '@nestjs/testing';
|
||||
import type { ExecutionContext, TestFn } from 'ava';
|
||||
import ava from 'ava';
|
||||
|
||||
import { ConfigModule } from '../src/base/config';
|
||||
import { AuthService } from '../src/core/auth';
|
||||
import { QuotaModule } from '../src/core/quota';
|
||||
import { CopilotModule } from '../src/plugins/copilot';
|
||||
import { prompts, PromptService } from '../src/plugins/copilot/prompt';
|
||||
import { ConfigModule } from '../base/config';
|
||||
import { AuthService } from '../core/auth';
|
||||
import { QuotaModule } from '../core/quota';
|
||||
import { CopilotModule } from '../plugins/copilot';
|
||||
import { prompts, PromptService } from '../plugins/copilot/prompt';
|
||||
import {
|
||||
CopilotProviderService,
|
||||
FalProvider,
|
||||
@@ -16,17 +16,17 @@ import {
|
||||
PerplexityProvider,
|
||||
registerCopilotProvider,
|
||||
unregisterCopilotProvider,
|
||||
} from '../src/plugins/copilot/providers';
|
||||
} from '../plugins/copilot/providers';
|
||||
import {
|
||||
CopilotChatTextExecutor,
|
||||
CopilotWorkflowService,
|
||||
GraphExecutorState,
|
||||
} from '../src/plugins/copilot/workflow';
|
||||
} from '../plugins/copilot/workflow';
|
||||
import {
|
||||
CopilotChatImageExecutor,
|
||||
CopilotCheckHtmlExecutor,
|
||||
CopilotCheckJsonExecutor,
|
||||
} from '../src/plugins/copilot/workflow/executor';
|
||||
} from '../plugins/copilot/workflow/executor';
|
||||
import { createTestingModule } from './utils';
|
||||
import { TestAssets } from './utils/copilot';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference types="../src/global.d.ts" />
|
||||
/// <reference types="../global.d.ts" />
|
||||
|
||||
import { randomUUID } from 'node:crypto';
|
||||
|
||||
@@ -7,11 +7,11 @@ import type { TestFn } from 'ava';
|
||||
import ava from 'ava';
|
||||
import Sinon from 'sinon';
|
||||
|
||||
import { ConfigModule } from '../src/base/config';
|
||||
import { AuthService } from '../src/core/auth';
|
||||
import { WorkspaceModule } from '../src/core/workspaces';
|
||||
import { CopilotModule } from '../src/plugins/copilot';
|
||||
import { prompts, PromptService } from '../src/plugins/copilot/prompt';
|
||||
import { ConfigModule } from '../base/config';
|
||||
import { AuthService } from '../core/auth';
|
||||
import { WorkspaceModule } from '../core/workspaces';
|
||||
import { CopilotModule } from '../plugins/copilot';
|
||||
import { prompts, PromptService } from '../plugins/copilot/prompt';
|
||||
import {
|
||||
CopilotProviderService,
|
||||
FalProvider,
|
||||
@@ -19,8 +19,8 @@ import {
|
||||
PerplexityProvider,
|
||||
registerCopilotProvider,
|
||||
unregisterCopilotProvider,
|
||||
} from '../src/plugins/copilot/providers';
|
||||
import { CopilotStorage } from '../src/plugins/copilot/storage';
|
||||
} from '../plugins/copilot/providers';
|
||||
import { CopilotStorage } from '../plugins/copilot/storage';
|
||||
import {
|
||||
acceptInviteById,
|
||||
createTestingApp,
|
||||
@@ -1,27 +1,27 @@
|
||||
/// <reference types="../src/global.d.ts" />
|
||||
/// <reference types="../global.d.ts" />
|
||||
|
||||
import { TestingModule } from '@nestjs/testing';
|
||||
import type { TestFn } from 'ava';
|
||||
import ava from 'ava';
|
||||
import Sinon from 'sinon';
|
||||
|
||||
import { ConfigModule } from '../src/base/config';
|
||||
import { AuthService } from '../src/core/auth';
|
||||
import { QuotaModule } from '../src/core/quota';
|
||||
import { CopilotModule } from '../src/plugins/copilot';
|
||||
import { prompts, PromptService } from '../src/plugins/copilot/prompt';
|
||||
import { ConfigModule } from '../base/config';
|
||||
import { AuthService } from '../core/auth';
|
||||
import { QuotaModule } from '../core/quota';
|
||||
import { CopilotModule } from '../plugins/copilot';
|
||||
import { prompts, PromptService } from '../plugins/copilot/prompt';
|
||||
import {
|
||||
CopilotProviderService,
|
||||
OpenAIProvider,
|
||||
registerCopilotProvider,
|
||||
unregisterCopilotProvider,
|
||||
} from '../src/plugins/copilot/providers';
|
||||
import { CitationParser } from '../src/plugins/copilot/providers/perplexity';
|
||||
import { ChatSessionService } from '../src/plugins/copilot/session';
|
||||
} from '../plugins/copilot/providers';
|
||||
import { CitationParser } from '../plugins/copilot/providers/perplexity';
|
||||
import { ChatSessionService } from '../plugins/copilot/session';
|
||||
import {
|
||||
CopilotCapability,
|
||||
CopilotProviderType,
|
||||
} from '../src/plugins/copilot/types';
|
||||
} from '../plugins/copilot/types';
|
||||
import {
|
||||
CopilotChatTextExecutor,
|
||||
CopilotWorkflowService,
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
WorkflowGraphExecutor,
|
||||
type WorkflowNodeData,
|
||||
WorkflowNodeType,
|
||||
} from '../src/plugins/copilot/workflow';
|
||||
} from '../plugins/copilot/workflow';
|
||||
import {
|
||||
CopilotChatImageExecutor,
|
||||
CopilotCheckHtmlExecutor,
|
||||
@@ -38,9 +38,9 @@ import {
|
||||
getWorkflowExecutor,
|
||||
NodeExecuteState,
|
||||
NodeExecutorType,
|
||||
} from '../src/plugins/copilot/workflow/executor';
|
||||
import { AutoRegisteredWorkflowExecutor } from '../src/plugins/copilot/workflow/executor/utils';
|
||||
import { WorkflowGraphList } from '../src/plugins/copilot/workflow/graph';
|
||||
} from '../plugins/copilot/workflow/executor';
|
||||
import { AutoRegisteredWorkflowExecutor } from '../plugins/copilot/workflow/executor/utils';
|
||||
import { WorkflowGraphList } from '../plugins/copilot/workflow/graph';
|
||||
import { createTestingModule } from './utils';
|
||||
import { MockCopilotTestProvider, WorkflowTestCases } from './utils/copilot';
|
||||
|
||||
@@ -6,9 +6,9 @@ import { PrismaClient } from '@prisma/client';
|
||||
import test from 'ava';
|
||||
import * as Sinon from 'sinon';
|
||||
|
||||
import { Config } from '../../src/base/config';
|
||||
import { DocStorageModule } from '../../src/core/doc';
|
||||
import { DocStorageCronJob } from '../../src/core/doc/job';
|
||||
import { Config } from '../../base/config';
|
||||
import { DocStorageModule } from '../../core/doc';
|
||||
import { DocStorageCronJob } from '../../core/doc/job';
|
||||
import { createTestingModule } from '../utils';
|
||||
|
||||
let m: TestingModule;
|
||||
@@ -4,12 +4,9 @@ import { PrismaClient } from '@prisma/client';
|
||||
import test from 'ava';
|
||||
import * as Sinon from 'sinon';
|
||||
|
||||
import {
|
||||
DocStorageModule,
|
||||
PgWorkspaceDocStorageAdapter,
|
||||
} from '../../src/core/doc';
|
||||
import { DocStorageOptions } from '../../src/core/doc/options';
|
||||
import { DocRecord } from '../../src/core/doc/storage';
|
||||
import { DocStorageModule, PgWorkspaceDocStorageAdapter } from '../../core/doc';
|
||||
import { DocStorageOptions } from '../../core/doc/options';
|
||||
import { DocRecord } from '../../core/doc/storage';
|
||||
import { createTestingModule, initTestingDB } from '../utils';
|
||||
|
||||
let m: TestingModule;
|
||||
@@ -1,14 +1,14 @@
|
||||
import { mkdirSync, writeFileSync } from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
import { Package } from '@affine-tools/utils/workspace';
|
||||
import type { INestApplication } from '@nestjs/common';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import type { TestFn } from 'ava';
|
||||
import ava from 'ava';
|
||||
import request from 'supertest';
|
||||
|
||||
import { DocRendererModule } from '../../src/core/doc-renderer';
|
||||
import { DocRendererModule } from '../../core/doc-renderer';
|
||||
import { createTestingApp } from '../utils';
|
||||
|
||||
const test = ava as TestFn<{
|
||||
@@ -48,10 +48,7 @@ function initTestStaticFiles(staticPath: string) {
|
||||
}
|
||||
|
||||
test.before('init selfhost server', async t => {
|
||||
const staticPath = path.join(
|
||||
fileURLToPath(import.meta.url),
|
||||
'../../../static'
|
||||
);
|
||||
const staticPath = new Package('@affine/server').join('static').value;
|
||||
initTestStaticFiles(staticPath);
|
||||
|
||||
const { app } = await createTestingApp({
|
||||
@@ -4,11 +4,11 @@ import test from 'ava';
|
||||
import * as Sinon from 'sinon';
|
||||
import { applyUpdate, Doc as YDoc, encodeStateAsUpdate } from 'yjs';
|
||||
|
||||
import { ConfigModule } from '../../src/base/config';
|
||||
import { ConfigModule } from '../../base/config';
|
||||
import {
|
||||
DocStorageModule,
|
||||
PgWorkspaceDocStorageAdapter as Adapter,
|
||||
} from '../../src/core/doc';
|
||||
} from '../../core/doc';
|
||||
import { createTestingModule, initTestingDB } from '../utils';
|
||||
|
||||
let m: TestingModule;
|
||||
@@ -1,18 +1,18 @@
|
||||
/// <reference types="../src/global.d.ts" />
|
||||
/// <reference types="../global.d.ts" />
|
||||
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import type { TestFn } from 'ava';
|
||||
import ava from 'ava';
|
||||
|
||||
import { Runtime } from '../src/base';
|
||||
import { AuthService } from '../src/core/auth/service';
|
||||
import { Runtime } from '../base';
|
||||
import { AuthService } from '../core/auth/service';
|
||||
import {
|
||||
FeatureManagementService,
|
||||
FeatureModule,
|
||||
FeatureService,
|
||||
FeatureType,
|
||||
} from '../src/core/features';
|
||||
import { WorkspaceResolver } from '../src/core/workspaces/resolvers';
|
||||
} from '../core/features';
|
||||
import { WorkspaceResolver } from '../core/workspaces/resolvers';
|
||||
import { createTestingApp } from './utils';
|
||||
import { WorkspaceResolverMock } from './utils/feature';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference types="../src/global.d.ts" />
|
||||
/// <reference types="../global.d.ts" />
|
||||
// This test case is for testing the mailer service.
|
||||
// Please use local SMTP server for testing.
|
||||
// See: https://github.com/mailhog/MailHog
|
||||
@@ -10,8 +10,8 @@ import { TestingModule } from '@nestjs/testing';
|
||||
import type { TestFn } from 'ava';
|
||||
import ava from 'ava';
|
||||
|
||||
import { ConfigModule } from '../src/base/config';
|
||||
import { AuthService } from '../src/core/auth/service';
|
||||
import { ConfigModule } from '../base/config';
|
||||
import { AuthService } from '../core/auth/service';
|
||||
import { createTestingModule } from './utils';
|
||||
|
||||
const test = ava as TestFn<{
|
||||
@@ -3,9 +3,9 @@ import type { TestFn } from 'ava';
|
||||
import ava from 'ava';
|
||||
import Sinon from 'sinon';
|
||||
|
||||
import { AppModule } from '../src/app.module';
|
||||
import { MailService } from '../src/base/mailer';
|
||||
import { FeatureManagementService } from '../src/core/features';
|
||||
import { AppModule } from '../app.module';
|
||||
import { MailService } from '../base/mailer';
|
||||
import { FeatureManagementService } from '../core/features';
|
||||
import { createTestingApp, createWorkspace, inviteUser, signUp } from './utils';
|
||||
const test = ava as TestFn<{
|
||||
app: INestApplication;
|
||||
@@ -4,9 +4,9 @@ import { PrismaClient } from '@prisma/client';
|
||||
import ava, { TestFn } from 'ava';
|
||||
import Sinon from 'sinon';
|
||||
|
||||
import { EmailAlreadyUsed } from '../../src/base';
|
||||
import { Permission } from '../../src/core/permission';
|
||||
import { UserModel } from '../../src/models/user';
|
||||
import { EmailAlreadyUsed } from '../../base';
|
||||
import { Permission } from '../../core/permission';
|
||||
import { UserModel } from '../../models/user';
|
||||
import { createTestingModule, initTestingDB } from '../utils';
|
||||
|
||||
interface Context {
|
||||
@@ -4,8 +4,8 @@ import { TestingModule } from '@nestjs/testing';
|
||||
import ava, { TestFn } from 'ava';
|
||||
import Sinon from 'sinon';
|
||||
|
||||
import { Locker, Mutex } from '../src/base/mutex';
|
||||
import { SessionRedis } from '../src/base/redis';
|
||||
import { Locker, Mutex } from '../base/mutex';
|
||||
import { SessionRedis } from '../base/redis';
|
||||
import { createTestingModule, sleep } from './utils';
|
||||
|
||||
const test = ava as TestFn<{
|
||||
@@ -20,8 +20,8 @@ import {
|
||||
AccessDenied,
|
||||
GatewayErrorWrapper,
|
||||
UserFriendlyError,
|
||||
} from '../../src/base';
|
||||
import { Public } from '../../src/core/auth';
|
||||
} from '../../base';
|
||||
import { Public } from '../../core/auth';
|
||||
import { createTestingApp } from '../utils';
|
||||
|
||||
@Public()
|
||||
@@ -1,4 +1,4 @@
|
||||
import '../../src/plugins/config';
|
||||
import '../../plugins/config';
|
||||
|
||||
import {
|
||||
Controller,
|
||||
@@ -12,15 +12,15 @@ import ava, { TestFn } from 'ava';
|
||||
import Sinon from 'sinon';
|
||||
import request, { type Response } from 'supertest';
|
||||
|
||||
import { AppModule } from '../../src/app.module';
|
||||
import { ConfigModule } from '../../src/base/config';
|
||||
import { AppModule } from '../../app.module';
|
||||
import { ConfigModule } from '../../base/config';
|
||||
import {
|
||||
CloudThrottlerGuard,
|
||||
SkipThrottle,
|
||||
Throttle,
|
||||
ThrottlerStorage,
|
||||
} from '../../src/base/throttler';
|
||||
import { AuthService, Public } from '../../src/core/auth';
|
||||
} from '../../base/throttler';
|
||||
import { AuthService, Public } from '../../core/auth';
|
||||
import { createTestingApp, initTestingDB, internalSignIn } from '../utils';
|
||||
|
||||
const test = ava as TestFn<{
|
||||
@@ -1,4 +1,4 @@
|
||||
import '../../src/plugins/config';
|
||||
import '../../plugins/config';
|
||||
|
||||
import { HttpStatus, INestApplication } from '@nestjs/common';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
@@ -6,15 +6,15 @@ import ava, { TestFn } from 'ava';
|
||||
import Sinon from 'sinon';
|
||||
import request from 'supertest';
|
||||
|
||||
import { AppModule } from '../../src/app.module';
|
||||
import { URLHelper } from '../../src/base';
|
||||
import { ConfigModule } from '../../src/base/config';
|
||||
import { CurrentUser } from '../../src/core/auth';
|
||||
import { AuthService } from '../../src/core/auth/service';
|
||||
import { UserService } from '../../src/core/user';
|
||||
import { OAuthProviderName } from '../../src/plugins/oauth/config';
|
||||
import { GoogleOAuthProvider } from '../../src/plugins/oauth/providers/google';
|
||||
import { OAuthService } from '../../src/plugins/oauth/service';
|
||||
import { AppModule } from '../../app.module';
|
||||
import { URLHelper } from '../../base';
|
||||
import { ConfigModule } from '../../base/config';
|
||||
import { CurrentUser } from '../../core/auth';
|
||||
import { AuthService } from '../../core/auth/service';
|
||||
import { UserService } from '../../core/user';
|
||||
import { OAuthProviderName } from '../../plugins/oauth/config';
|
||||
import { GoogleOAuthProvider } from '../../plugins/oauth/providers/google';
|
||||
import { OAuthService } from '../../plugins/oauth/service';
|
||||
import { createTestingApp, getSession, initTestingDB } from '../utils';
|
||||
|
||||
const test = ava as TestFn<{
|
||||
@@ -1,4 +1,4 @@
|
||||
# Snapshot report for `tests/payment/service.spec.ts`
|
||||
# Snapshot report for `src/__tests__/payment/service.spec.ts`
|
||||
|
||||
The actual snapshot is saved in `service.spec.ts.snap`.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import '../../src/plugins/payment';
|
||||
import '../../plugins/payment';
|
||||
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
@@ -6,16 +6,13 @@ import ava, { TestFn } from 'ava';
|
||||
import Sinon from 'sinon';
|
||||
import Stripe from 'stripe';
|
||||
|
||||
import { AppModule } from '../../src/app.module';
|
||||
import { EventEmitter, Runtime } from '../../src/base';
|
||||
import { ConfigModule } from '../../src/base/config';
|
||||
import { CurrentUser } from '../../src/core/auth';
|
||||
import { AuthService } from '../../src/core/auth/service';
|
||||
import {
|
||||
EarlyAccessType,
|
||||
FeatureManagementService,
|
||||
} from '../../src/core/features';
|
||||
import { SubscriptionService } from '../../src/plugins/payment/service';
|
||||
import { AppModule } from '../../app.module';
|
||||
import { EventEmitter, Runtime } from '../../base';
|
||||
import { ConfigModule } from '../../base/config';
|
||||
import { CurrentUser } from '../../core/auth';
|
||||
import { AuthService } from '../../core/auth/service';
|
||||
import { EarlyAccessType, FeatureManagementService } from '../../core/features';
|
||||
import { SubscriptionService } from '../../plugins/payment/service';
|
||||
import {
|
||||
CouponType,
|
||||
encodeLookupKey,
|
||||
@@ -23,7 +20,7 @@ import {
|
||||
SubscriptionRecurring,
|
||||
SubscriptionStatus,
|
||||
SubscriptionVariant,
|
||||
} from '../../src/plugins/payment/types';
|
||||
} from '../../plugins/payment/types';
|
||||
import { createTestingApp, initTestingDB } from '../utils';
|
||||
|
||||
const PRO_MONTHLY = `${SubscriptionPlan.Pro}_${SubscriptionRecurring.Monthly}`;
|
||||
@@ -1,20 +1,20 @@
|
||||
/// <reference types="../src/global.d.ts" />
|
||||
/// <reference types="../global.d.ts" />
|
||||
|
||||
import { TestingModule } from '@nestjs/testing';
|
||||
import type { TestFn } from 'ava';
|
||||
import ava from 'ava';
|
||||
|
||||
import { AuthService } from '../src/core/auth';
|
||||
import { AuthService } from '../core/auth';
|
||||
import {
|
||||
QuotaManagementService,
|
||||
QuotaModule,
|
||||
QuotaService,
|
||||
QuotaType,
|
||||
} from '../src/core/quota';
|
||||
import { OneGB, OneMB } from '../src/core/quota/constant';
|
||||
import { FreePlan, ProPlan } from '../src/core/quota/schema';
|
||||
import { StorageModule, WorkspaceBlobStorage } from '../src/core/storage';
|
||||
import { WorkspaceResolver } from '../src/core/workspaces/resolvers';
|
||||
} from '../core/quota';
|
||||
import { OneGB, OneMB } from '../core/quota/constant';
|
||||
import { FreePlan, ProPlan } from '../core/quota/schema';
|
||||
import { StorageModule, WorkspaceBlobStorage } from '../core/storage';
|
||||
import { WorkspaceResolver } from '../core/workspaces/resolvers';
|
||||
import { createTestingModule } from './utils';
|
||||
import { WorkspaceResolverMock } from './utils/feature';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference types="../src/global.d.ts" />
|
||||
/// <reference types="../global.d.ts" />
|
||||
|
||||
import { randomUUID } from 'node:crypto';
|
||||
|
||||
@@ -9,17 +9,13 @@ import type { TestFn } from 'ava';
|
||||
import ava from 'ava';
|
||||
import Sinon from 'sinon';
|
||||
|
||||
import { AppModule } from '../src/app.module';
|
||||
import { EventEmitter } from '../src/base';
|
||||
import { AuthService } from '../src/core/auth';
|
||||
import { DocContentService } from '../src/core/doc-renderer';
|
||||
import { Permission, PermissionService } from '../src/core/permission';
|
||||
import {
|
||||
QuotaManagementService,
|
||||
QuotaService,
|
||||
QuotaType,
|
||||
} from '../src/core/quota';
|
||||
import { WorkspaceType } from '../src/core/workspaces';
|
||||
import { AppModule } from '../app.module';
|
||||
import { EventEmitter } from '../base';
|
||||
import { AuthService } from '../core/auth';
|
||||
import { DocContentService } from '../core/doc-renderer';
|
||||
import { Permission, PermissionService } from '../core/permission';
|
||||
import { QuotaManagementService, QuotaService, QuotaType } from '../core/quota';
|
||||
import { WorkspaceType } from '../core/workspaces';
|
||||
import {
|
||||
acceptInviteById,
|
||||
approveMember,
|
||||
@@ -2,7 +2,7 @@ import type { INestApplication } from '@nestjs/common';
|
||||
import test from 'ava';
|
||||
import request from 'supertest';
|
||||
|
||||
import { AppModule } from '../src/app.module';
|
||||
import { AppModule } from '../app.module';
|
||||
import { createTestingApp, currentUser, signUp } from './utils';
|
||||
|
||||
let app: INestApplication;
|
||||
@@ -3,8 +3,8 @@ import type { TestFn } from 'ava';
|
||||
import ava from 'ava';
|
||||
import request from 'supertest';
|
||||
|
||||
import { AppModule } from '../../src/app.module';
|
||||
import { AuthService, CurrentUser } from '../../src/core/auth';
|
||||
import { AppModule } from '../../app.module';
|
||||
import { AuthService, CurrentUser } from '../../core/auth';
|
||||
import { createTestingApp, gql, internalSignIn } from '../utils';
|
||||
|
||||
const test = ava as TestFn<{
|
||||
@@ -6,7 +6,7 @@ import request from 'supertest';
|
||||
import {
|
||||
DEFAULT_DIMENSIONS,
|
||||
OpenAIProvider,
|
||||
} from '../../src/plugins/copilot/providers/openai';
|
||||
} from '../../plugins/copilot/providers/openai';
|
||||
import {
|
||||
CopilotCapability,
|
||||
CopilotChatOptions,
|
||||
@@ -19,13 +19,13 @@ import {
|
||||
CopilotTextToTextProvider,
|
||||
PromptConfig,
|
||||
PromptMessage,
|
||||
} from '../../src/plugins/copilot/types';
|
||||
import { NodeExecutorType } from '../../src/plugins/copilot/workflow/executor';
|
||||
} from '../../plugins/copilot/types';
|
||||
import { NodeExecutorType } from '../../plugins/copilot/workflow/executor';
|
||||
import {
|
||||
WorkflowGraph,
|
||||
WorkflowNodeType,
|
||||
WorkflowParams,
|
||||
} from '../../src/plugins/copilot/workflow/types';
|
||||
} from '../../plugins/copilot/workflow/types';
|
||||
import { gql } from './common';
|
||||
import { handleGraphQLError, sleep } from './utils';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { PrismaClient, WorkspaceMemberStatus } from '@prisma/client';
|
||||
|
||||
import { Permission } from '../../src/core/permission';
|
||||
import { UserType } from '../../src/core/user/types';
|
||||
import { Permission } from '../../core/permission';
|
||||
import { UserType } from '../../core/user/types';
|
||||
|
||||
@Injectable()
|
||||
export class WorkspaceResolverMock {
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { INestApplication } from '@nestjs/common';
|
||||
import request from 'supertest';
|
||||
|
||||
import type { InvitationType } from '../../src/core/workspaces';
|
||||
import type { InvitationType } from '../../core/workspaces';
|
||||
import { gql } from './common';
|
||||
|
||||
export async function inviteUser(
|
||||
@@ -5,9 +5,9 @@ import {
|
||||
AuthService,
|
||||
type ClientTokenType,
|
||||
type CurrentUser,
|
||||
} from '../../src/core/auth';
|
||||
import { sessionUser } from '../../src/core/auth/service';
|
||||
import { UserService, type UserType } from '../../src/core/user';
|
||||
} from '../../core/auth';
|
||||
import { sessionUser } from '../../core/auth/service';
|
||||
import { UserService, type UserType } from '../../core/user';
|
||||
import { gql } from './common';
|
||||
|
||||
export type UserAuthedType = UserType & { token: ClientTokenType };
|
||||
@@ -8,12 +8,12 @@ import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs';
|
||||
import type { Response } from 'supertest';
|
||||
import supertest from 'supertest';
|
||||
|
||||
import { AppModule, FunctionalityModules } from '../../src/app.module';
|
||||
import { GlobalExceptionFilter, Runtime } from '../../src/base';
|
||||
import { GqlModule } from '../../src/base/graphql';
|
||||
import { AuthGuard, AuthModule } from '../../src/core/auth';
|
||||
import { UserFeaturesInit1698652531198 } from '../../src/data/migrations/1698652531198-user-features-init';
|
||||
import { ModelModules } from '../../src/models';
|
||||
import { AppModule, FunctionalityModules } from '../../app.module';
|
||||
import { GlobalExceptionFilter, Runtime } from '../../base';
|
||||
import { GqlModule } from '../../base/graphql';
|
||||
import { AuthGuard, AuthModule } from '../../core/auth';
|
||||
import { UserFeaturesInit1698652531198 } from '../../data/migrations/1698652531198-user-features-init';
|
||||
import { ModelModules } from '../../models';
|
||||
|
||||
export type PermissionEnum = 'Owner' | 'Admin' | 'Write' | 'Read';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { INestApplication } from '@nestjs/common';
|
||||
import request from 'supertest';
|
||||
|
||||
import type { WorkspaceType } from '../../src/core/workspaces';
|
||||
import type { WorkspaceType } from '../../core/workspaces';
|
||||
import { gql } from './common';
|
||||
import { PermissionEnum } from './utils';
|
||||
|
||||
@@ -7,10 +7,10 @@ import { PrismaClient } from '@prisma/client';
|
||||
import type { TestFn } from 'ava';
|
||||
import ava from 'ava';
|
||||
|
||||
import { AppModule } from '../src/app.module';
|
||||
import { MailService } from '../src/base/mailer';
|
||||
import { AuthService } from '../src/core/auth/service';
|
||||
import { UserService } from '../src/core/user';
|
||||
import { AppModule } from '../app.module';
|
||||
import { MailService } from '../base/mailer';
|
||||
import { AuthService } from '../core/auth/service';
|
||||
import { UserService } from '../core/user';
|
||||
import {
|
||||
acceptInviteById,
|
||||
createTestingApp,
|
||||
@@ -4,7 +4,7 @@ import type { TestFn } from 'ava';
|
||||
import ava from 'ava';
|
||||
import request from 'supertest';
|
||||
|
||||
import { AppModule } from '../src/app.module';
|
||||
import { AppModule } from '../app.module';
|
||||
import {
|
||||
acceptInviteById,
|
||||
createTestingApp,
|
||||
@@ -2,9 +2,9 @@ import type { INestApplication } from '@nestjs/common';
|
||||
import test from 'ava';
|
||||
import request from 'supertest';
|
||||
|
||||
import { AppModule } from '../../src/app.module';
|
||||
import { FeatureManagementService, FeatureType } from '../../src/core/features';
|
||||
import { QuotaService, QuotaType } from '../../src/core/quota';
|
||||
import { AppModule } from '../../app.module';
|
||||
import { FeatureManagementService, FeatureType } from '../../core/features';
|
||||
import { QuotaService, QuotaType } from '../../core/quota';
|
||||
import {
|
||||
collectAllBlobSizes,
|
||||
createTestingApp,
|
||||
@@ -6,11 +6,11 @@ import ava, { TestFn } from 'ava';
|
||||
import Sinon from 'sinon';
|
||||
import request from 'supertest';
|
||||
|
||||
import { AppModule } from '../../src/app.module';
|
||||
import { CurrentUser } from '../../src/core/auth';
|
||||
import { AuthService } from '../../src/core/auth/service';
|
||||
import { PgWorkspaceDocStorageAdapter } from '../../src/core/doc';
|
||||
import { WorkspaceBlobStorage } from '../../src/core/storage';
|
||||
import { AppModule } from '../../app.module';
|
||||
import { CurrentUser } from '../../core/auth';
|
||||
import { AuthService } from '../../core/auth/service';
|
||||
import { PgWorkspaceDocStorageAdapter } from '../../core/doc';
|
||||
import { WorkspaceBlobStorage } from '../../core/storage';
|
||||
import { createTestingApp, internalSignIn } from '../utils';
|
||||
|
||||
const test = ava as TestFn<{
|
||||
@@ -13,6 +13,7 @@
|
||||
"references": [
|
||||
{ "path": "../../../tests/kit" },
|
||||
{ "path": "../../../tools/cli" },
|
||||
{ "path": "../../../tools/utils" },
|
||||
{ "path": "../native" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"rootDir": ".",
|
||||
"outDir": "./lib",
|
||||
"tsBuildInfoFile": "./lib/tsconfig.tsbuildinfo"
|
||||
},
|
||||
"include": ["./scripts", "./tests"]
|
||||
}
|
||||
Reference in New Issue
Block a user