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

Backend] Implement Karate tests for apartment_images table #85

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

akintewe
Copy link

Description

Implements comprehensive Karate tests for apartment_images table functionality.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Changes made

  • Added apartment_images.feature test file with CRUD scenarios
  • Configured Hasura metadata for apartment_images table
  • Added test data migrations
  • Implemented table constraints verification

How to test

  1. Start test environment:
    bash
    docker compose -f docker-compose-test.yml up -d
  2. Run Karate tests:
    bash
    docker compose -f docker-compose-test.yml run --rm karate

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Related Issues

Closes #82

@sotoJ24 sotoJ24 self-requested a review January 24, 2025 18:04
Copy link
Contributor

@sotoJ24 sotoJ24 left a comment

Choose a reason for hiding this comment

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

Hi @akintewe, I hope you're doing well, thanks a lot for the work, I have a question, could you tell why you have two migrations as Aparments Images in the folder? Is not neccesary to create a folder default, you can use the: \Backend\migrations\safetrust migrations folder

Screenshot 2025-01-25 143352

}
"""
When method POST
Then status 200
Copy link
Contributor

Choose a reason for hiding this comment

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

When creating a new resource or object (such as an apartment image), the HTTP status code should ideally be 201 Created instead of 200 OK

Copy link
Author

Choose a reason for hiding this comment

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

alright ill modify it

}
}
"""
When method POST
Copy link
Contributor

Choose a reason for hiding this comment

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

The method in this Scenario could be Delete with the Status 204

@akintewe akintewe requested a review from sotoJ24 January 26, 2025 17:03
@sotoJ24
Copy link
Contributor

sotoJ24 commented Jan 26, 2025

Thanks a lot, on it

@sotoJ24
Copy link
Contributor

sotoJ24 commented Jan 27, 2025

Could you please remove the migrations/default folder, use the \Backend\migrations\safetrust instead please

406687104-e55edcc0-9d3a-4a50-ab30-9dde972c42a4

@akintewe
Copy link
Author

Could you please remove the migrations/default folder, use the \Backend\migrations\safetrust instead please

406687104-e55edcc0-9d3a-4a50-ab30-9dde972c42a4

sure

@akintewe
Copy link
Author

Done @sotoJ24

Copy link
Contributor

@rvalenciano rvalenciano left a comment

Choose a reason for hiding this comment

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

@akintewe , I think we don't need to add migrations to add test data, as we already have seeds in charge of this.

Can you please remove:

  • the new migration.

Also, why do we need the tests/metadata files?

@akintewe
Copy link
Author

@akintewe , I think we don't need to add migrations to add test data, as we already have seeds in charge of this.

Can you please remove:

  • the new migration.

Also, why do we need the tests/metadata files?

alright ill fix this

@akintewe
Copy link
Author

I have removed the migration, the metadata is needed because they define the GraphQL API structure for Hasura, and also they setup the table tracking and relationships, they can also configure permissions for the admin role. @rvalenciano

@akintewe akintewe requested a review from rvalenciano January 28, 2025 17:58
Copy link
Contributor

@sotoJ24 sotoJ24 left a comment

Choose a reason for hiding this comment

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

Dear @akintewe, could you please remove the file
tests/metadata/databases/ file, can you use the

/Backend/metadata/databases/safetrust in its place.

also, we would be grateful if you could replace the file metadata/databases/safetrust/ with the tests/metadata/databases/ file metadata_apartment_images.yaml.

for the tests/metadata/databases/default/tables/public_apartment_images.yaml you apply here,

regards and thanks so much

@akintewe akintewe requested a review from sotoJ24 January 31, 2025 07:54
@akintewe
Copy link
Author

Dear @akintewe, could you please remove the file tests/metadata/databases/ file, can you use the

/Backend/metadata/databases/safetrust in its place.

also, we would be grateful if you could replace the file metadata/databases/safetrust/ with the tests/metadata/databases/ file metadata_apartment_images.yaml.

for the tests/metadata/databases/default/tables/public_apartment_images.yaml you apply here,

regards and thanks so much

Please review

Copy link
Contributor

@sotoJ24 sotoJ24 left a comment

Choose a reason for hiding this comment

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

Dear @akintewe the test passes the following scenarios:

  • Checking the health of the GraphQL endpoint ✅.
  • Checking the apartment_images schema✅.
  • Checking the query permissions✅.
  • Verify the existence of the apartment_images table✅.

fails the following scenarios:

  • Create new apartment image
    Screenshot 2025-01-31 151919

  • Verify that the apartment_images schema exists
    Screenshot 2025-01-31 151930

  • Verify that mutations are available
    Screenshot 2025-01-31 151936

  • Query apartment image by ID
    Screenshot 2025-01-31 151941

  • Update apartment image
    Screenshot 2025-01-31 151956

  • List apartment images
    Screenshot 2025-01-31 152002

  • Delete apartment image
    Screenshot 2025-01-31 152008

Thank you very much for adding the aparment_images.yaml in the metadata folder.

@sotoJ24 sotoJ24 self-requested a review February 5, 2025 00:08
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.

[Backend] Implement Karate tests for apartment_images table
3 participants