mirror of
https://github.com/mengxi-ream/read-frog.git
synced 2026-04-30 01:56:46 +00:00
53 lines
1.3 KiB
JavaScript
53 lines
1.3 KiB
JavaScript
import { describe, expect, it } from "vitest"
|
|
|
|
import { splitTopRepositories } from "./github-api.js"
|
|
|
|
describe("splitTopRepositories", () => {
|
|
it("keeps non-fork repos for OSS influence and excludes forks", () => {
|
|
const result = splitTopRepositories([
|
|
{
|
|
isFork: true,
|
|
nameWithOwner: "kilidoc/read-frog",
|
|
parent: { nameWithOwner: "mengxi-ream/read-frog" },
|
|
stargazerCount: 5040,
|
|
},
|
|
{
|
|
isFork: false,
|
|
nameWithOwner: "kilidoc/anki-langkit",
|
|
parent: null,
|
|
stargazerCount: 42,
|
|
},
|
|
{
|
|
isFork: false,
|
|
nameWithOwner: "kilidoc/browser-tools",
|
|
parent: null,
|
|
stargazerCount: 5,
|
|
},
|
|
])
|
|
|
|
expect(result).toEqual({
|
|
excludedForkRepositories: [
|
|
{
|
|
isFork: true,
|
|
nameWithOwner: "kilidoc/read-frog",
|
|
parentNameWithOwner: "mengxi-ream/read-frog",
|
|
stargazerCount: 5040,
|
|
},
|
|
],
|
|
topRepositories: [
|
|
{
|
|
isFork: false,
|
|
nameWithOwner: "kilidoc/anki-langkit",
|
|
parentNameWithOwner: null,
|
|
stargazerCount: 42,
|
|
},
|
|
{
|
|
isFork: false,
|
|
nameWithOwner: "kilidoc/browser-tools",
|
|
parentNameWithOwner: null,
|
|
stargazerCount: 5,
|
|
},
|
|
],
|
|
})
|
|
})
|
|
})
|