Browse Source

fix: path correction

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5444/head
Pranav C 1 year ago
parent
commit
974e033a3c
  1. 14
      packages/nocodb-nest/src/modules/test/TestResetService/resetMetaSakilaSqliteProject.ts
  2. 6
      packages/nocodb-nest/src/modules/test/TestResetService/resetMysqlSakilaProject.ts
  3. 5
      packages/nocodb-nest/src/modules/test/TestResetService/resetPgSakilaProject.ts

14
packages/nocodb-nest/src/modules/test/TestResetService/resetMetaSakilaSqliteProject.ts

@ -1,11 +1,9 @@
import { promises as fs } from 'fs';
import axios from 'axios';
import path from 'path'
const sqliteFilePath = (parallelId: string) => {
const rootDir = __dirname.replace(
'/src/modules/test/TestResetService',
'',
);
const rootDir = process.cwd()
return `${rootDir}/test_sakila_${parallelId}.db`;
};
@ -78,10 +76,10 @@ const deleteSqliteFileIfExists = async (parallelId: string) => {
};
const seedSakilaSqliteFile = async (parallelId: string) => {
const testsDir = __dirname.replace(
'/src/modules/test/TestResetService',
'/tests',
);
const testsDir = path.join(
process.cwd(),
'tests'
);;
await fs.copyFile(
`${testsDir}/sqlite-sakila-db/sakila.db`,

6
packages/nocodb-nest/src/modules/test/TestResetService/resetMysqlSakilaProject.ts

@ -1,4 +1,5 @@
import { promises as fs } from 'fs';
import path from 'path';
import axios from 'axios';
import { knex } from 'knex';
import Audit from '../../../models/Audit';
@ -85,10 +86,7 @@ const resetSakilaMysql = async (
parallelId: string,
isEmptyProject: boolean,
) => {
const testsDir = __dirname.replace(
'/src/modules/test/TestResetService',
'/tests',
);
const testsDir = path.join(process.cwd(), '/tests');
try {
await knex.raw(`DROP DATABASE test_sakila_${parallelId}`);

5
packages/nocodb-nest/src/modules/test/TestResetService/resetPgSakilaProject.ts

@ -1,6 +1,7 @@
import { promises as fs } from 'fs';
import axios from 'axios';
import { knex } from 'knex';
import path from 'path'
import Audit from '../../../models/Audit';
import type Project from '../../../models/Project';
@ -78,8 +79,8 @@ const isSakilaPgToBeReset = async (parallelId: string, project?: Project) => {
};
const resetSakilaPg = async (parallelId: string, isEmptyProject: boolean) => {
const testsDir = __dirname.replace(
'/src/modules/test/TestResetService',
const testsDir = path.join(
process.cwd(),
'/tests',
);

Loading…
Cancel
Save