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

add tests #2

Merged
merged 20 commits into from
Nov 21, 2024
Merged

add tests #2

merged 20 commits into from
Nov 21, 2024

Conversation

alxndr
Copy link
Member

@alxndr alxndr commented Nov 20, 2024

[fixes #1]

@alxndr alxndr added the WIP label Nov 20, 2024
@alxndr alxndr requested a review from InblEric November 21, 2024 02:05
@alxndr alxndr removed the WIP label Nov 21, 2024
tsconfig.json Show resolved Hide resolved
index.test.ts Show resolved Hide resolved
index.test.ts Outdated
vi.mocked(login).mockRejectedValue('mocked bluesky.login()')
})
test('throws', async () => {
await expect(() => handlePayload(payload)).rejects.toThrow('mocked bluesky.login()')

Choose a reason for hiding this comment

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

Why is the exception message saying it's mocked rather than invalid? I know during this test it is mocked but in a general sense it's invalid

Copy link
Member Author

Choose a reason for hiding this comment

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

handlePayload will re-throw any errors it receives, so that the AWS logs show what went wrong... I can clarify this a bit though

})
test('does _not_ post the song title', async () => {
await handlePayload(payload)
expect(mockedPost).not.toHaveBeenCalled()

Choose a reason for hiding this comment

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

Love that we do this to avoid double posting.

Choose a reason for hiding this comment

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

I wonder if we accidentally add a new song and then remove it (maybe it turns out to just be a tease or jam), if we'd be able to retroactively delete the associated post. This isn't really relevant to this PR though.

Copy link
Member Author

Choose a reason for hiding this comment

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

I wonder if we accidentally add a new song and then remove it (maybe it turns out to just be a tease or jam), if we'd be able to retroactively delete the associated post. This isn't really relevant to this PR though.

hmmm yeah that's a bit tricky at this point... would be a sweet add-on though

@alxndr alxndr merged commit 47cbeae into main Nov 21, 2024
2 checks passed
@alxndr alxndr deleted the spike/vitest branch November 21, 2024 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add test suite
2 participants