generated from ubiquity/ts-template
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: untested class to get all information
- Loading branch information
Showing
4 changed files
with
66 additions
and
12 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,43 @@ | ||
import { GetActivity } from "./get-activity"; | ||
import { parseGitHubUrl } from "./start"; | ||
import { config } from "dotenv"; | ||
|
||
config(); | ||
const GITHUB_TOKEN = process.env.GITHUB_TOKEN; | ||
if (!GITHUB_TOKEN) { | ||
console.warn("GITHUB_TOKEN is not set"); | ||
} | ||
// Mock process.argv | ||
process.argv = ["path/to/node", "path/to/script", `--auth=${GITHUB_TOKEN}`]; | ||
|
||
describe("GetActivity class", () => { | ||
let activity: GetActivity; | ||
|
||
beforeAll(async () => { | ||
const issue22 = parseGitHubUrl("https://github.com/ubiquibot/comment-incentives/issues/22"); | ||
activity = new GetActivity(issue22); | ||
// Wait for all promises to resolve | ||
await Promise.all([activity.self, activity.events, activity.comments, activity.linkedReviews]); | ||
console.dir(activity, { depth: null, colors: true }); | ||
}); | ||
|
||
it("should create an instance of GetActivity", () => { | ||
expect(activity).toBeInstanceOf(GetActivity); | ||
}); | ||
|
||
it("should initialize self as an object", () => { | ||
expect(typeof activity.self).toBe("object"); | ||
}); | ||
|
||
it("should initialize events as an object", () => { | ||
expect(typeof activity.events).toBe("object"); | ||
}); | ||
|
||
it("should initialize comments as an object", () => { | ||
expect(typeof activity.comments).toBe("object"); | ||
}); | ||
|
||
it("should initialize linkedReviews as an array", () => { | ||
expect(Array.isArray(activity.linkedReviews)).toBe(true); | ||
}); | ||
}); |
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
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
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