-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(context-module): new external plugin loader
need the correct implementation when the CAL service is ready to use
- Loading branch information
1 parent
0a20997
commit df2bf9a
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
libs/ledgerjs/packages/context-module/src/loaders/ExternalPluginLoader.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { LoaderOptions } from "../models/LoaderOptions"; | ||
import { Transaction } from "../models/Transaction"; | ||
import { ExternalPluginLoader } from "./ExternalPluginLoader"; | ||
|
||
describe("ExternalPluginLoader", () => { | ||
let loader: ExternalPluginLoader; | ||
const transaction = {} as Transaction; | ||
|
||
beforeEach(() => { | ||
jest.restoreAllMocks(); | ||
loader = new ExternalPluginLoader(); | ||
}); | ||
|
||
describe("load function", () => { | ||
it("should return an empty array", async () => { | ||
const options = {} as LoaderOptions; | ||
|
||
const result = await loader.load(transaction, options); | ||
|
||
expect(result).toEqual([]); | ||
}); | ||
}); | ||
}); |
12 changes: 12 additions & 0 deletions
12
libs/ledgerjs/packages/context-module/src/loaders/ExternalPluginLoader.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { LoaderOptions } from "../models/LoaderOptions"; | ||
import { Transaction } from "../models/Transaction"; | ||
import { ContextLoader } from "./ContextLoader"; | ||
|
||
export class ExternalPluginLoader implements ContextLoader { | ||
constructor() {} | ||
|
||
async load(_transaction: Transaction, _options: LoaderOptions) { | ||
// TODO: implement the call to the CAL service when implemented | ||
return Promise.resolve([]); | ||
} | ||
} |