import { type GitHubEvent, GitHubReasons } from "stacker/github";
import { test, equal, evalGitHubEvent } from "stacker/testing";
// Base event for tests
const baseEvent: GitHubEvent = {
title: "Issue",
url: "https://github.com/placeholder/placeholder/issues/1",
reason: "",
type: "Issue",
repository: {
fullName: "placeholder/placeholder",
name: "placeholder",
url: "https://github.com/placeholder/placeholder",
private: false,
description: "A placeholder repository",
fork: false,
owner: {
login: "placeholder",
url: "https://github.com/placeholder",
type: "User",
siteAdmin: false
}
}
};
test("Grafana repository with Subscribed reason", () => {
const event: GitHubEvent = {
...baseEvent,
reason: GitHubReasons.Subscribed,
repository: {
...baseEvent.repository,
owner: { ...baseEvent.repository.owner, login: "grafana" },
fullName: "grafana/k6",
name: "k6"
}
};
const { stacks } = evalGitHubEvent(event);
equal(stacks, ["work"]);
});