svelte-cloudinary
svelte-cloudinary copied to clipboard
feat: #147 GetCldOgImageUrl Tests
Description
Creating basic tests for GetCldOgImageUrl
Issue Ticket Number
Fixes #147
Type of change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Fix or improve the documentation
- [ ] This change requires a documentation update
Checklist
- [x] I have followed the contributing guidelines of this project as mentioned in CONTRIBUTING.md
- [x] I have created an issue ticket for this PR
- [x] I have checked to ensure there aren't other open Pull Requests for the same update/change?
- [x] I have performed a self-review of my own code
- [x] I have run tests locally to ensure they all pass
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes needed to the documentation
⚠️ No Changeset found
Latest commit: 122a5de771e4db7dcac984d01be28b58843591fa
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
@sccalabr is attempting to deploy a commit to the Cloudinary DevX Team on Vercel.
A member of the Team first needs to authorize it.
I am having a hard time testing this. I am running the pnpm run tests but I am getting
if (!config.cloud?.cloudName) {
20| throw new Error('[svelte-cloudinary] unable to find a cloud name');
| ^
21| }
My .env has
VITE_CLOUDINARY_CLOUD_NAME
VITE_CLOUDINARY_API_KEY
so not really sure what I am missing
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| svelte-cloudinary | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Oct 2, 2024 10:18am |
Oh I think I see - for tests we don't use a real cloud name, as we aren't actually making any requests to cloudinary. We're only testing the output to see if it's what we expect, for example that it contains the correct width. When testing a component you can use the config prop (example), but here we use the second argument to getCldOgImage to pass the cloud.cloudName arg, which can be anything as it's not real. I've been using testing as a dummy cloud name.
Does that make sense?
My .env has
Is the cloud name filled out with your cloud name from the dashboard?
Im pretty sure it is. I got it from the api account dashboard. I'll double check later today
Oh I think I see - for tests we don't use a real cloud name, as we aren't actually making any requests to cloudinary. We're only testing the output to see if it's what we expect, for example that it contains the correct width. When testing a component you can use the
config prop(example), but here we use the second argument togetCldOgImageto pass thecloud.cloudNamearg, which can be anything as it's not real. I've been usingtestingas a dummy cloud name.Does that make sense?
I see, let me give that a try :)
awesome! let me know if you need any more help :pray:
I think I got it working. Let me know what you think!
Last things! Are you getting an error in your IDE about missing an
altproperty in any of these options?
I am not seeing any errors in vscode for that. Should I be?
I am not seeing any errors in vscode for that. Should I be?
Ah, no you're right - I was getting confused with the component version :sweat_smile:
perfect, thank you!
@all-contributors please add @sccalabr for test
@sccalabr thanks for your contribution. This PR is eligible for free Cloudinary Hacktoberfest swag. Please send me an email to [email protected] with your name, GitHub username, a link to this PR. Happy Hacktoberfest!