You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current Behavior
I update the probot to 11.0.5, and object { Application } = require("probot") is deprecated. I found the equivalent one { probot }.
When I run my unit test, it always returns "Error: secretOrPrivateKey must have a value". I have already mock-up the method I am going to test, how can I fix this error? Thank you.
Before I initialized the app from Application obj, it didn't require me to provide any credentials.
const{ Probot }=require("probot");//Used to be const { Application } = require("probot");constplugin=require("..");constpullRequestOpenedPayload=require("./fixtures/pull_request.opened.json");describe("Size",()=>{letprobot;letoctokit;beforeEach(async()=>{probot=newProbot();//Used to be app = new Application()plugin(probot);octokit={issues: {addLabels: jest.fn().mockReturnValue(Promise.resolve({})),},};probot.auth=()=>Promise.resolve(octokit);});test("creates a label when a pull request is opened",async()=>{awaitprobot.receive({name: "pull_request.opened",payload: pullRequestOpenedPayload,});expect(octokit.issues.addLabels).toHaveBeenCalled();});});
Environment
Probot version(s): [e.g. 11.0.5]
The text was updated successfully, but these errors were encountered:
I would recommend against mocking the octokit instance. If a future version renames the octokit.issues.addLabels method, your tests will still pass, but it will fail in production. I would mock the http requests instead, see https://probot.github.io/docs/testing/
I think new Probot() won't work, try new Probot({ githubToken: "test" }) instead
Bug Report
Current Behavior
I update the probot to 11.0.5, and object { Application } = require("probot") is deprecated. I found the equivalent one { probot }.
When I run my unit test, it always returns "Error: secretOrPrivateKey must have a value". I have already mock-up the method I am going to test, how can I fix this error? Thank you.
Before I initialized the app from Application obj, it didn't require me to provide any credentials.
Environment
The text was updated successfully, but these errors were encountered: