diff --git a/packages/server-core/src/projects/project-permission/project-permission.test.ts b/packages/server-core/src/projects/project-permission/project-permission.test.ts index 85d6406f2a..57519f8f7a 100644 --- a/packages/server-core/src/projects/project-permission/project-permission.test.ts +++ b/packages/server-core/src/projects/project-permission/project-permission.test.ts @@ -43,10 +43,10 @@ import { destroyEngine } from '@etherealengine/ecs/src/Engine' import { Application } from '../../../declarations' import { createFeathersKoaApp } from '../../createApp' -const newProjectName1 = 'projecttest_test_project_name_1' +const newProjectName1 = '@org/projecttest_test_project_name_1' const cleanup = async (app: Application) => { - const project1Dir = path.resolve(appRootPath.path, `packages/projects/projects/${newProjectName1}/`) + const project1Dir = path.resolve(appRootPath.path, `packages/projects/projects/${newProjectName1.split('/')[0]}/`) deleteFolderRecursive(project1Dir) try { await app.service(projectPath).remove(null, { query: { name: newProjectName1 } }) diff --git a/packages/server-core/src/projects/project/project.test.ts b/packages/server-core/src/projects/project/project.test.ts index 3ac8cdf0ed..6c62a4dd0d 100644 --- a/packages/server-core/src/projects/project/project.test.ts +++ b/packages/server-core/src/projects/project/project.test.ts @@ -45,7 +45,7 @@ import { createFeathersKoaApp } from '../../createApp' import { useGit } from '../../util/gitHelperFunctions' const cleanup = async (app: Application, projectName: string) => { - const projectDir = path.resolve(appRootPath.path, `packages/projects/projects/${projectName}/`) + const projectDir = path.resolve(appRootPath.path, `packages/projects/projects/${projectName.split('/')[0]}/`) deleteFolderRecursive(projectDir) const removingProjects = await app.service(projectPath).find({ query: { name: projectName } }) if (removingProjects.data.length) await app.service(projectPath).remove(removingProjects.data[0].id) diff --git a/packages/server-core/src/route/route/route.test.ts b/packages/server-core/src/route/route/route.test.ts index d6f41a29de..be4efc6134 100644 --- a/packages/server-core/src/route/route/route.test.ts +++ b/packages/server-core/src/route/route/route.test.ts @@ -40,11 +40,11 @@ import { createFeathersKoaApp } from '../../createApp' const params = { isInternal: true } as any -const cleanup = async (app: Application, projectName: string) => { - const projectDir = path.resolve(appRootPath.path, `packages/projects/projects/${projectName}/`) +const cleanup = async (app: Application, projectName: string, projectId: string) => { + const projectDir = path.resolve(appRootPath.path, `packages/projects/projects/${projectName.split('/')[0]}/`) deleteFolderRecursive(projectDir) try { - await app.service(projectPath).remove(null, { query: { name: projectName } }) + await app.service(projectPath).remove(projectId) } catch (e) { // } @@ -80,6 +80,7 @@ describe('route.test', () => { let app: Application let testProject: string let testRoute: string + let testProjectId: string before(async () => { app = createFeathersKoaApp() @@ -87,7 +88,7 @@ describe('route.test', () => { }) after(async () => { - await cleanup(app, testProject) + await cleanup(app, testProject, testProjectId) await destroyEngine() }) @@ -95,7 +96,7 @@ describe('route.test', () => { testProject = `@org1/test-project-${uuidv4()}` testRoute = `test-route-${uuidv4()}` - await app.service(projectPath).create({ name: testProject }, params) + testProjectId = await (await app.service(projectPath).create({ name: testProject }, params)).id updateXREngineConfigForTest(testProject, testRoute) const installedRoutes = await app.service('routes-installed').find() diff --git a/packages/server-core/src/route/route/route.ts b/packages/server-core/src/route/route/route.ts index 2f56fb017d..e7b7f39b6c 100644 --- a/packages/server-core/src/route/route/route.ts +++ b/packages/server-core/src/route/route/route.ts @@ -57,10 +57,18 @@ declare module '@etherealengine/common/declarations' { export const getInstalledRoutes = () => { return async () => { + const rootPath = path.resolve(__dirname, '../../../../projects/projects/') const projects = fs - .readdirSync(path.resolve(__dirname, '../../../../projects/projects/'), { withFileTypes: true }) + .readdirSync(rootPath, { withFileTypes: true }) .filter((dirent) => dirent.isDirectory()) .map((dirent) => dirent.name) + .map((orgname) => { + return fs + .readdirSync(path.join(rootPath, orgname), { withFileTypes: true }) + .filter((dirent) => dirent.isDirectory()) + .map((dirent) => `${orgname}/${dirent.name}`) + }) + .flat() const data: InstalledRoutesInterface[] = [] await Promise.all(