Skip to content

Commit

Permalink
refactor: add test so build does not fail
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhnm committed Jan 2, 2024
1 parent 6e73001 commit ccd59b9
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/application/usecases.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import "reflect-metadata";
import { GetBpmnFilesUseCase } from "./usecases";
import { GetBpmnFilesOutPort } from "./ports/out";
import { BpmnFile } from "./model";
import { expect } from "chai";

describe("get bpmn files", () => {
class GetBpmnFilesAdapter implements GetBpmnFilesOutPort {
getBpmnFiles(): Promise<BpmnFile[]> {
return Promise.resolve([
new BpmnFile("file1", "workspace1", "full/Path/workspace1/file1.bpmn"),
new BpmnFile("file2", "workspace2", "full/Path/workspace2/file2.bpmn"),
new BpmnFile("file3", "workspace2", "full/Path/workspace2/file3.bpmn"),
]);
}
}

it("should return bpmn files", async () => {
const getBpmnFilesUseCase = new GetBpmnFilesUseCase(new GetBpmnFilesAdapter());
const bpmnFiles = await getBpmnFilesUseCase.getBpmnFiles();

expect(JSON.stringify(bpmnFiles)).to.equal(
JSON.stringify([
new BpmnFile("file1", "workspace1", "full/Path/workspace1/file1.bpmn"),
new BpmnFile("file2", "workspace2", "full/Path/workspace2/file2.bpmn"),
new BpmnFile("file3", "workspace2", "full/Path/workspace2/file3.bpmn"),
]),
);
});
});

0 comments on commit ccd59b9

Please sign in to comment.