mirror of
https://github.com/tauri-apps/tauri-github-bot.git
synced 2026-01-31 00:35:20 +01:00
29 lines
967 B
TypeScript
29 lines
967 B
TypeScript
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import { it, expect, describe } from "vitest";
|
|
import { COMMAND_REGEX } from "../src/constants";
|
|
|
|
describe("Parses command info from a GitHub comment", () => {
|
|
it("Parses upstream command", async () => {
|
|
const comment = "/upstream tauri-apps/tao";
|
|
const [, command, owner, repo] = COMMAND_REGEX.exec(comment)!;
|
|
expect(command).toBe("upstream");
|
|
expect(owner).toBe("tauri-apps");
|
|
expect(repo).toBe("tao");
|
|
});
|
|
|
|
it("Parses nothing from a slash predicated comment ", async () => {
|
|
const comment = "/downstream rust-lang/rust";
|
|
const matches = COMMAND_REGEX.exec(comment);
|
|
expect(matches).toBeNull();
|
|
});
|
|
|
|
it("Parses nothing", async () => {
|
|
const comment = "fasdk asfjadf asd;klajsdf qwrpo";
|
|
const matches = COMMAND_REGEX.exec(comment);
|
|
expect(matches).toBeNull();
|
|
});
|
|
});
|