Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cubejs-backend-shared/src/FileRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class FileRepository implements SchemaFileRepository {
}

public localPath(): string {
return path.join(process.cwd(), this.repositoryPath);
return path.resolve(process.cwd(), this.repositoryPath);
}

protected async getFiles(dir: string, fileList: string[] = []): Promise<string[]> {
Expand Down
31 changes: 31 additions & 0 deletions packages/cubejs-backend-shared/test/FileRepository.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import fs from 'fs-extra';
import os from 'os';
import path from 'path';

import { FileRepository } from '../src/FileRepository';

describe('FileRepository', () => {
let repositoryPath: string;

beforeEach(() => {
repositoryPath = fs.mkdtempSync(path.join(os.tmpdir(), 'cube-models-'));
});

afterEach(() => {
fs.removeSync(repositoryPath);
});

test('reads data models from an absolute repository path', async () => {
fs.writeFileSync(path.join(repositoryPath, 'orders.yml'), 'cubes: []');

const repository = new FileRepository(repositoryPath);

expect(repository.localPath()).toBe(repositoryPath);
await expect(repository.dataSchemaFiles()).resolves.toEqual([
{
fileName: 'orders.yml',
content: 'cubes: []',
},
]);
});
});
Loading