hunk.code_window:     .getByTestId('create-workspace-input')
       .type('Test Workspace 1', { delay: 50 });
     await page.getByTestId('create-workspace-create-button').click();
     await page.getByTestId('workspace-name').click();
     await page.getByTestId('workspace-card').nth(1).click();
     await page.getByTestId('slider-bar-workspace-setting-button').click();
     await page
       .getByTestId('upload-avatar')
       .setInputFiles('./tests/fixtures/smile.png');
  
hunk.labels: keep keep keep keep keep replace keep keep keep
hunk.after_edit:   await page.getByTestId('settings-modal-trigger').click();
     await page.getByText('current').click();
  
hunk.file_path: tests/parallels/local-first-avatar.spec.ts
hunk.type: replace
file: // eslint-disable-next-line simple-import-sort/imports
  import type { DynamicModule, FactoryProvider } from '@nestjs/common';
  import { merge } from 'lodash-es';
  
  import type { DeepPartial } from '../utils/types';
  import type { AFFiNEConfig } from './def';
  
  import '../prelude';
  
  type ConstructorOf<T> = {
    new (): T;
  };
  
  function ApplyType<T>(): ConstructorOf<T> {
    // @ts-expect-error used to fake the type of config
    return class Inner implements T {
      constructor() {}
    };
  }
  
  /**
   * usage:
   * ```
   * import { Config } from '@affine/server'
   *
   * class TestConfig {
   *   constructor(private readonly config: Config) {}
   *   test() {
   *     return this.config.env
   *   }
   * }
   * ```
   */
  export class Config extends ApplyType<AFFiNEConfig>() {}
  
  function createConfigProvider(
    override?: DeepPartial<Config>
  ): FactoryProvider<Config> {
    return {
      provide: Config,
      useFactory: () => {
        const wrapper = new Config();
        const config = merge({}, globalThis.AFFiNE, override);
  
        const proxy: Config = new Proxy(wrapper, {
          get: (_target, property: keyof Config) => {
            const desc = Object.getOwnPropertyDescriptor(
              globalThis.AFFiNE,
              property
            );
            if (desc?.get) {
              return desc.get.call(proxy);
            }
            return config[property];
          },
        });
        return proxy;
      },
    };
  }
  
  export class ConfigModule {
    static forRoot = (override?: DeepPartial<Config>): DynamicModule => {
      const provider = createConfigProvider(override);
  
      return {
        global: true,
        module: ConfigModule,
        providers: [provider],
        exports: [provider],
      };
    };
  }
  
  export type { AFFiNEConfig } from './def';
  