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 Unit Tests for Modal Component and NFT Submission Flow #269

Merged
merged 7 commits into from
Nov 13, 2024

Conversation

viniblack
Copy link
Member

Pull Request Summary

Type of Change

  • Other (Unit tests)

Description

This PR adds and enhances unit tests for the Modal component and the mintNFT function. The primary goal is to validate the correct functionality of lesson submission via the modal, including calling the mintNFT function to create an NFT. The added mocks and test setup ensure that data interactions and verifications are aligned with the lesson submission flow and NFT generation.

Files included in this PR:

  • components/Modal/index.spec.js: Tests modal content and interaction, ensuring the text and buttons display correctly.
  • tests/modalSubmissionLesson.test.js: Verifies the lesson submission flow, confirming the correct invocation of the mintNFT function.
  • tests/submissionLesson.test.js: Tests the creation of a submission document in Firestore and the execution of the mintNFT trigger function.

Testing Performed

The following tests were conducted:

  1. Modal Content Display: Verifies displayed elements and the ability to change text field content.
  2. submitLessonInFirestore Call in Modal: Tests lesson submission and calls the mintNFT function post-submission, ensuring lesson data is passed correctly.
  3. Submission Document Creation: Integration test to verify creation of a document in lessons_submissions and execution of the mintNFT trigger.

Related Issues

Checklist

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

- Move test data initialization to  to reduce redundancy.
- Extract submission document creation to .
- Simplify main test body to focus on core assertions.
Copy link

vercel bot commented Nov 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
web3-bootcamp-platform ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 13, 2024 5:18pm

@viniblack viniblack linked an issue Nov 11, 2024 that may be closed by this pull request
8 tasks
tests/modalSubmissionLesson.test.js Outdated Show resolved Hide resolved
tests/modalSubmissionLesson.test.js Outdated Show resolved Hide resolved
tests/submissionLesson.test.js Outdated Show resolved Hide resolved
This test is not testing anything in the end, it is only creating a doc at firebase and checking if it was created.
@nomadbitcoin nomadbitcoin merged commit 3737775 into main Nov 13, 2024
5 of 6 checks passed
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.

Create Tests for Build Registration When Cohort Ends
2 participants