Skip to content

Commit

Permalink
Ensure change data source is called
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanLeRoy committed Nov 14, 2024
1 parent a543654 commit 7b3ab5e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/core/services/DatabaseService/DatabaseServiceNoop.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import DatabaseService from ".";

export default class DatabaseServiceNoop extends DatabaseService {
public deleteSourceMetadata(): Promise<void> {
return Promise.reject("DatabaseServiceNoop:deleteSourceMetadata");
}

public execute(): Promise<void> {
return Promise.reject("DatabaseServiceNoop:execute");
}
Expand Down
13 changes: 13 additions & 0 deletions packages/core/state/selection/test/logics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
selectNearbyFile,
SET_SORT_COLUMN,
changeDataSources,
changeSourceMetadata,
} from "../actions";
import { initialState, interaction } from "../../";
import Annotation from "../../../entity/Annotation";
Expand All @@ -40,6 +41,7 @@ import FileSort, { SortOrder } from "../../../entity/FileSort";
import { DatasetService } from "../../../services";
import { DataSource } from "../../../services/DataSourceService";
import HttpFileService from "../../../services/FileService/HttpFileService";
import DatabaseServiceNoop from "../../../services/DatabaseService/DatabaseServiceNoop";
import FileDownloadServiceNoop from "../../../services/FileDownloadService/FileDownloadServiceNoop";

describe("Selection logics", () => {
Expand Down Expand Up @@ -947,7 +949,17 @@ describe("Selection logics", () => {
it("dispatches new hierarchy, filters, sort, source, & opened folders from given URL", async () => {
// Arrange
const annotations = annotationsJson.map((annotation) => new Annotation(annotation));
class MockDatabaseService extends DatabaseServiceNoop {
public deleteSourceMetadata(): Promise<void> {
return Promise.resolve();
}
}
const state = mergeState(initialState, {
interaction: {
platformDependentServices: {
databaseService: new MockDatabaseService(),
},
},
metadata: {
annotations,
dataSources: mockDataSources,
Expand Down Expand Up @@ -998,6 +1010,7 @@ describe("Selection logics", () => {
payload: sortColumn,
})
).to.be.true;
expect(actions.includesMatch(changeSourceMetadata())).to.be.true;
expect(actions.includesMatch(changeDataSources(mockDataSources))).to.be.true;
});
});
Expand Down

0 comments on commit 7b3ab5e

Please sign in to comment.