Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sshivaditya committed Oct 12, 2024
1 parent d1b4514 commit dd4c334
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/helpers/issue-fetching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export async function fetchLinkedIssues(params: FetchParams) {
}

for (const comment of comments) {
const foundIssues = idIssueFromComment(comment.body, params);
const foundIssues = idIssueFromComment(comment.body);
const foundCodes = comment.body ? await fetchCodeLinkedFromIssue(comment.body, params.context, comment.issueUrl) : [];

if (foundIssues) {
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/issue-handling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function handleSpec(
streamlinedComments: Record<string, StreamlinedComment[]>
) {
specAndBodies[key] = specOrBody;
const otherReferences = idIssueFromComment(specOrBody, params);
const otherReferences = idIssueFromComment(specOrBody);
if (otherReferences) {
for (const ref of otherReferences) {
const anotherKey = createKey(ref.url, ref.issueNumber);
Expand Down Expand Up @@ -87,7 +87,7 @@ export async function handleComment(
streamlinedComments: Record<string, StreamlinedComment[]>,
seen: Set<string>
) {
const otherReferences = idIssueFromComment(comment.body, params);
const otherReferences = idIssueFromComment(comment.body);
if (otherReferences) {
for (const ref of otherReferences) {
const key = createKey(ref.url);
Expand Down
7 changes: 1 addition & 6 deletions src/helpers/issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,10 @@ export function splitKey(key: string): [string, string, string] {
* @param params - Additional parameters that may include context information.
* @returns An array of linked issues or null if no issues are found.
*/
export function idIssueFromComment(comment?: string | null, params?: FetchParams): LinkedIssues[] | null {
export function idIssueFromComment(comment?: string | null): LinkedIssues[] | null {
const urlMatch = comment?.match(/https?:\/\/(?:www\.)?github\.com\/([^/]+)\/([^/]+)\/(pull|issues?)\/(\d+)/g);
const response: LinkedIssues[] = [];

//Check if valid issue is in the params
if (params && !(params.issueNum && params.owner && params.repo)) {
return null;
}

if (urlMatch) {
urlMatch.forEach((url) => {
response.push(createLinkedIssueOrPr(url));
Expand Down

0 comments on commit dd4c334

Please sign in to comment.