Skip to content

Commit

Permalink
fix: type
Browse files Browse the repository at this point in the history
  • Loading branch information
vpbs2 committed Aug 26, 2024
1 parent 356614b commit 75c4bc6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion meerkat-dbm/src/dbm/__test__/dbm-parallel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ iFrameRunnerManager.iFrameManagers.set('2', runnerMock as any);

describe('DBMParallel', () => {
let dbmParallel: DBMParallel;
let fileManager: FileManagerType;
let fileManager: FileManagerType<SharedArrayBuffer>;
let instanceManager: InstanceManager;

beforeAll(async () => {
Expand Down
12 changes: 6 additions & 6 deletions meerkat-dbm/src/dbm/__test__/mock.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ export class InstanceManager implements InstanceManagerType {
}
}

export class MockFileManager implements FileManagerType {
private fileBufferStore: Record<string, FileBufferStore> = {};
export class MockFileManager<T> implements FileManagerType<T> {
private fileBufferStore: Record<string, FileBufferStore<T>> = {};
private tables: Record<string, Table> = {};

async bulkRegisterFileBuffer(props: FileBufferStore[]): Promise<void> {
async bulkRegisterFileBuffer(props: FileBufferStore<T>[]): Promise<void> {
for (const prop of props) {
this.fileBufferStore[prop.fileName] = prop;
this.tables[prop.tableName] = this.tables[prop.tableName] || {
Expand All @@ -63,7 +63,7 @@ export class MockFileManager implements FileManagerType {
}
}

async registerFileBuffer(prop: FileBufferStore): Promise<void> {
async registerFileBuffer(prop: FileBufferStore<T>): Promise<void> {
this.fileBufferStore[prop.fileName] = prop;
this.tables[prop.tableName] = this.tables[prop.tableName] || { files: [] };
this.tables[prop.tableName].files.push(prop);
Expand All @@ -80,11 +80,11 @@ export class MockFileManager implements FileManagerType {

this.registerFileBuffer({
...fileData,
buffer: new Uint8Array(),
buffer: [] as T,
});
}

async getFileBuffer(name: string): Promise<Uint8Array> {
async getFileBuffer(name: string): Promise<T> {
const fileBuffer = this.fileBufferStore[name];
if (!fileBuffer) {
throw new Error(`File buffer for ${name} not found`);
Expand Down

0 comments on commit 75c4bc6

Please sign in to comment.