Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: test driftage #311

Merged
merged 3 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/api/openSaucedApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ describe("openSaucedUserEndpoint", () => {
expect(data.login).toBe("bdougie");
})

it("should return a 404 error for a user that does not exist", async () => {
const response = await fetch(`${OPEN_SAUCED_USERS_ENDPOINT}/1`);
expect(response.status).toBe(404);
it("should return a bad request for a user that does not exist", async () => {
const response = await fetch(`${OPEN_SAUCED_USERS_ENDPOINT}/foolala`);
expect(response.status).toBe(400);
})
})

Expand Down
2 changes: 1 addition & 1 deletion test/utils/urlMatcher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ test('getPullRequestAPIURL', async () => {
expect(await getPullRequestAPIURL('https://github.com/open-sauced/ai/pull/164')).toBe('https://api.github.com/repos/open-sauced/ai/pulls/164')
expect(await getPullRequestAPIURL('https://github.com/open-sauced/ai/pull/163')).toBe('https://api.github.com/repos/open-sauced/ai/pulls/163')
expect(await getPullRequestAPIURL('https://github.com/open-sauced/ai/compare/some-branch')).toBe('https://api.github.com/repos/open-sauced/ai/compare/beta...some-branch')
expect(await getPullRequestAPIURL('https://github.com/tailwindlabs/tailwindcss/compare/some-branch')).toBe('https://api.github.com/repos/tailwindlabs/tailwindcss/compare/master...some-branch')
expect(await getPullRequestAPIURL('https://github.com/tailwindlabs/tailwindcss/compare/some-branch')).toBe('https://api.github.com/repos/tailwindlabs/tailwindcss/compare/next...some-branch')
Copy link
Member

@nickytonline nickytonline Aug 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the failure as it looks like the tailwindlabs/tailwindcss project changed a branch name, but, and not for this PR, but I'd probably mock the network request that gets the default branch name for all these tests, i.e.

const response = await fetch(`https://api.github.com/repos/${username}/${repoName}`);
const { default_branch } = await response.json();

expect(await getPullRequestAPIURL('https://github.com/open-sauced/ai/compare/beta...some-branch')).toBe('https://api.github.com/repos/open-sauced/ai/compare/beta...some-branch')
expect(await getPullRequestAPIURL('https://github.com/tailwindlabs/tailwindcss/compare/master...some-branch')).toBe('https://api.github.com/repos/tailwindlabs/tailwindcss/compare/master...some-branch')

Expand Down
Loading