Browse Source

Merge pull request #5863 from nocodb/test/meta-db-empty-project

test: use meta-db project for non-sakila db
codecov_istanbul
Raju Udava 1 year ago committed by GitHub
parent
commit
fe8506f010
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 33
      packages/nocodb/src/controllers/test/TestResetService/resetMetaSakilaSqliteProject.ts

33
packages/nocodb/src/controllers/test/TestResetService/resetMetaSakilaSqliteProject.ts

@ -1,6 +1,7 @@
import { promises as fs } from 'fs';
import path from 'path';
import axios from 'axios';
import type { AxiosResponse } from 'axios';
const sqliteFilePath = (parallelId: string) => {
const rootDir = process.cwd();
@ -46,23 +47,37 @@ const resetMetaSakilaSqliteProject = async ({
if (!isEmptyProject) await seedSakilaSqliteFile(parallelId);
await createProject(token, title, parallelId);
await createProject(token, title, parallelId, isEmptyProject);
};
const createProject = async (
token: string,
title: string,
parallelId: string,
isEmptyProject: boolean,
) => {
const response = await axios.post(
'http://localhost:8080/api/v1/db/meta/projects/',
sakilaProjectConfig(title, parallelId),
{
headers: {
'xc-auth': token,
let response: AxiosResponse;
if (isEmptyProject) {
response = await axios.post(
'http://localhost:8080/api/v1/db/meta/projects/',
{ title },
{
headers: {
'xc-auth': token,
},
},
},
);
);
} else {
response = await axios.post(
'http://localhost:8080/api/v1/db/meta/projects/',
sakilaProjectConfig(title, parallelId),
{
headers: {
'xc-auth': token,
},
},
);
}
if (response.status !== 200) {
console.error('Error creating project', response.data);
}

Loading…
Cancel
Save