-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(resolvers): added dummy resolver to clouds that don't require re…
…solvers to work
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
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,21 @@ | ||
//#region Imports | ||
|
||
import { Resolver, ResolverContract } from '../../contracts'; | ||
|
||
//#endregion | ||
|
||
/** | ||
* The class that represents a dummy resolver that does nothing and can be used by the cloud that doesn't use resolvers. | ||
*/ | ||
export class DummyResolver | ||
implements ResolverContract<any, any, any, any, any> | ||
{ | ||
/** | ||
* @inheritDoc | ||
*/ | ||
public createResolver(): Resolver<any, void> { | ||
return { | ||
run: () => Promise.resolve(), | ||
}; | ||
} | ||
} |
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,13 @@ | ||
import { DummyResolver } from '../../src/resolvers/dummy/dummy.resolver'; | ||
|
||
describe(DummyResolver.name, () => { | ||
it('should do nothing when called and return undefined', () => { | ||
const resolver = new DummyResolver(); | ||
|
||
const task = jest.fn(); | ||
|
||
resolver.createResolver().run(task); | ||
|
||
expect(task).not.toHaveBeenCalled(); | ||
}); | ||
}); |