Skip to content

Conversation

@sccalabr
Copy link
Contributor

@sccalabr sccalabr commented Oct 1, 2024

Description

Creating basic tests for GetCldOgImageUrl

Issue Ticket Number

Fixes #147

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • 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

  • I have followed the contributing guidelines of this project as mentioned in CONTRIBUTING.md
  • I have created an issue ticket for this PR
  • I have checked to ensure there aren't other open Pull Requests for the same update/change?
  • I have performed a self-review of my own code
  • I have run tests locally to ensure they all pass
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes needed to the documentation

@changeset-bot
Copy link

changeset-bot bot commented Oct 1, 2024

⚠️ No Changeset found

Latest commit: 122a5de

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

@vercel
Copy link

vercel bot commented Oct 1, 2024

@sccalabr is attempting to deploy a commit to the Cloudinary DevX Team on Vercel.

A member of the Team first needs to authorize it.

@sccalabr sccalabr marked this pull request as ready for review October 1, 2024 23:45
@sccalabr
Copy link
Contributor Author

sccalabr commented Oct 1, 2024

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

@sccalabr sccalabr force-pushed the hacktoberfest branch 2 times, most recently from b378eba to 554d9f5 Compare October 1, 2024 23:53
@vercel
Copy link

vercel bot commented Oct 2, 2024

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

@ghostdevv
Copy link
Collaborator

My .env has

Is the cloud name filled out with your cloud name from the dashboard?

@ghostdevv
Copy link
Collaborator

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?

@sccalabr
Copy link
Contributor Author

sccalabr commented Oct 3, 2024

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

@sccalabr
Copy link
Contributor Author

sccalabr commented Oct 3, 2024

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?

I see, let me give that a try :)

@ghostdevv
Copy link
Collaborator

awesome! let me know if you need any more help 🙏

@sccalabr sccalabr force-pushed the hacktoberfest branch 2 times, most recently from 554d9f5 to 95bc8b6 Compare October 5, 2024 19:57
@sccalabr
Copy link
Contributor Author

sccalabr commented Oct 5, 2024

I think I got it working. Let me know what you think!

@sccalabr sccalabr changed the title GetCldOgImageUrl Tests feat: #147 GetCldOgImageUrl Tests Oct 6, 2024
Copy link
Collaborator

@ghostdevv ghostdevv left a comment

Choose a reason for hiding this comment

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

Last things! Are you getting an error in your IDE about missing an alt property in any of these options?

format: options.format ?? 'jpg',
width: options.width ?? 1200,
height: options.height ?? 627,
height: options.height ?? 630,
Copy link
Collaborator

Choose a reason for hiding this comment

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

The 627 that was here before is the right one 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then we need to update the documentation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

@ghostdevv ghostdevv Oct 9, 2024

Choose a reason for hiding this comment

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

Oh good catch, would you like to update that? It's in packages/docs/src/content/docs/helpers/getcldogimageurl/configuration.mdx

@sccalabr
Copy link
Contributor Author

sccalabr commented Oct 8, 2024

Last things! Are you getting an error in your IDE about missing an alt property in any of these options?

I am not seeing any errors in vscode for that. Should I be?

@ghostdevv
Copy link
Collaborator

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 😅

@ghostdevv
Copy link
Collaborator

perfect, thank you!

@ghostdevv ghostdevv changed the title feat: #147 GetCldOgImageUrl Tests test: add tests for getCldOgImageUrl Oct 11, 2024
@ghostdevv ghostdevv merged commit aadeade into cloudinary-community:main Oct 11, 2024
4 of 5 checks passed
@ghostdevv
Copy link
Collaborator

@all-contributors please add @sccalabr for test

@allcontributors
Copy link
Contributor

@ghostdevv

I've put up a pull request to add @sccalabr! 🎉

@colbyfayock
Copy link
Contributor

@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!

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 tests for getCldOgImageUrl

3 participants