Skip to content

Commit

Permalink
feat(resolvers): added dummy resolver to clouds that don't require re…
Browse files Browse the repository at this point in the history
…solvers to work
  • Loading branch information
H4ad committed May 25, 2022
1 parent d59890a commit d3e0840
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/resolvers/dummy/dummy.resolver.ts
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(),
};
}
}
13 changes: 13 additions & 0 deletions test/resolvers/dummy.resolver.spec.ts
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();
});
});

0 comments on commit d3e0840

Please sign in to comment.