huridocs/uwazi

View on GitHub
app/api/search.v2/specs/setupTestingEnvironment.ts

Summary

Maintainability
A
30 mins
Test Coverage
A
100%
import db, { DBFixture } from 'api/utils/testing_db';
import { testingEnvironment } from 'api/utils/testingEnvironment';

const setupTestingEnviroment = async (data: DBFixture, index?: string) =>
  testingEnvironment.setUp(
    {
      ...data,
      settings: [
        {
          _id: db.id(),
          languages: [
            { key: 'en', label: 'EN', default: true },
            { key: 'es', label: 'ES' },
          ],
        },
      ],
    },
    index
  );

export { setupTestingEnviroment };