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 API tests for CloudinaryImage field type #3467

Closed
wants to merge 47 commits into from

Conversation

singhArmani
Copy link
Contributor

  • Added filter, isRequired tests for CloudinaryImage field type.
  • Used github secrets in git workflow ('jest')
  • Cleanup cloudinary resources after tests are completed to avoid exceeding the upload limit.

@changeset-bot
Copy link

changeset-bot bot commented Aug 25, 2020

🦋 Changeset is good to go

Latest commit: 6201507

We got this.

This PR includes changesets to release 2 packages
Name Type
@keystonejs/api-tests Patch
@keystonejs/fields-cloudinary-image Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@singhArmani singhArmani force-pushed the add-filter-tests-cloudinary branch from 0a54045 to 0ef5284 Compare August 25, 2020 05:48
Copy link
Contributor

@timleslie timleslie left a comment

Choose a reason for hiding this comment

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

A few comments and questions below.

'@keystonejs/fields-cloudinary-image': patch
---

Add `filter`, `isRequired` and CRUD tests for `CloudinaryImage` field type.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Add `filter`, `isRequired` and CRUD tests for `CloudinaryImage` field type.
Added `filter`, `isRequired` and CRUD tests for `CloudinaryImage` field type.

@@ -31,7 +31,7 @@
"express-pino-logger": "^4.0.0",
"falsey": "^1.0.0",
"fs-extra": "^7.0.0",
"globby": "^11.0.0",
"globby": "^11.0.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

The package version bumps here should result in a changeset for all the affected packages. In general it's probably best to leave and version bumps out of a feature PR like this unless they're actually required.


// This function will run after all the tests are completed.
// We use it to cleanup the resources (e.g Cloudinary images) which are no longer required.
export const afterAll = () => cloudinary.v2.api.delete_resources_by_prefix('cloudinary-test');
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's move this code up to the top section of the file. We want to keep all the module config in a single location.

};

export const initItems = () => {
let items = testFiles.map((p, i) => ({ name: `file${i}`, image: prepareFile(p) }));
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
let items = testFiles.map((p, i) => ({ name: `file${i}`, image: prepareFile(p) }));
const items = testFiles.map((p, i) => ({ name: `file${i}`, image: prepareFile(p) }));

packages/fields-cloudinary-image/src/test-fixtures.js Outdated Show resolved Hide resolved
@singhArmani singhArmani force-pushed the add-filter-tests-cloudinary branch from 0ef5284 to d43ae1c Compare August 27, 2020 06:26
renovate bot and others added 24 commits August 27, 2020 16:57
* Add filter and CRUD test for Unsplash field

* Add delete operation API test Unsplash field type
* Removed unsupported filter options for field types (#3501)

* Add delete operation API test LocationGoogle
* Add filter and CRUD tests for AutoIncrement field

* Remove unsupported adapter field type tests
* Add filter & CRUD tests for MongoId field

* Fix the _in: null filter operation in mongoid
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
renovate bot and others added 23 commits August 31, 2020 10:58
* Rename demo-projects folder to examples

* Update test-projects/README.md

Co-authored-by: Tim Leslie <[email protected]>

* Fix some strange git ignoreness

Co-authored-by: Tim Leslie <[email protected]>
@singhArmani
Copy link
Contributor Author

Fixing this mess in another branch.

@singhArmani singhArmani closed this Sep 1, 2020
@timleslie timleslie deleted the add-filter-tests-cloudinary branch December 21, 2020 21:30
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.

5 participants