Skip to content

Commit

Permalink
binded objects to methods that were exposed by other classes (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhbapna authored Dec 8, 2022
1 parent 1223e86 commit 03516b1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kie/mock-github",
"version": "0.1.1",
"version": "0.1.2",
"description": "A bunch of tools to configure and create a local github environment to test your github actions in without having to clutter your github with test repositories, actions or hitting github api rate limits.",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
Expand Down
19 changes: 13 additions & 6 deletions src/github/action/action-mocker.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { Mocker } from "@mg/github/mocker";
import { Action, ActionMockerMethods } from "@mg/github/action/action-mocker.types";
import {
Action,
ActionMockerMethods,
} from "@mg/github/action/action-mocker.types";
import { ArchiveArtifactsMocker } from "@mg/github/action/archive/archive-mocker";
import { ArchiveArtifactsMockerMethods } from "@mg/github/action/archive/archive-mocker.types";
import { InputMocker } from "@mg/github/action/input/input-mocker";
Expand Down Expand Up @@ -33,16 +36,20 @@ export class ActionMocker implements Mocker, ActionMockerMethods {

get input(): InputMockerMethods {
return {
get: this.inputMocker.get,
delete: this.inputMocker.delete,
update: this.inputMocker.update,
get: this.inputMocker.get.bind(this.inputMocker),
delete: this.inputMocker.delete.bind(this.inputMocker),
update: this.inputMocker.update.bind(this.inputMocker),
};
}

get archiver(): ArchiveArtifactsMockerMethods {
return {
getArtifactStore: this.archiveArtifactsMocker.getArtifactStore,
getRunId: this.archiveArtifactsMocker.getRunId,
getArtifactStore: this.archiveArtifactsMocker.getArtifactStore.bind(
this.archiveArtifactsMocker
),
getRunId: this.archiveArtifactsMocker.getRunId.bind(
this.archiveArtifactsMocker
),
};
}
}
6 changes: 3 additions & 3 deletions src/github/github-mocker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ export class MockGithub implements Mocker {
throw new Error("Env has not been setup");
}
return {
update: this.envMocker.update,
delete: this.envMocker.delete,
get: this.envMocker.get,
update: this.envMocker.update.bind(this.envMocker),
delete: this.envMocker.delete.bind(this.envMocker),
get: this.envMocker.get.bind(this.envMocker),
};
}

Expand Down

0 comments on commit 03516b1

Please sign in to comment.