Description
The NFTRepository (src/modules/nft/repositories/nft.repository.ts) is responsible for persisting and retrieving NFT entities.
To ensure correctness and reliability, we need to add comprehensive tests with special focus on how the repository handles references to NFTs (IDs, user ownership, relations).
This will provide confidence in NFT persistence logic and act as documentation for how NFTs are referenced throughout the system.
What is expected
- A new test suite for
NFTRepository covering reference-related operations.
- Verification that NFTs can be:
- Created and correctly referenced by ID.
- Queried by user ID or project association.
- Deleted and no longer retrievable by reference.
- Ensure repository behavior aligns with existing domain contracts (
INFTRepository).
What should be modified
- Add a new test file:
src/modules/nft/__tests__/repositories/nft.repository.test.ts
- Write unit tests for:
createNFT() – creates an NFT and returns its reference.
getNFTById() – retrieves an NFT using its ID.
getNFTByUserId() – retrieves NFTs owned by a specific user.
deleteNFT() – removes an NFT and ensures the reference is gone.
- Mock Prisma client or use the SQLite test DB (
.env.test).
- Follow test patterns from existing repositories, e.g.:
message-prisma.repository.test.ts
volunteer-prisma.repository.test.ts
- Run full test suite and ensure all tests pass.
Acceptance criteria
- New test suite exists under
src/modules/nft/__tests__/repositories/.
- All reference-related methods in
NFTRepository are tested.
- CRUD operations behave as expected in tests.
- Test coverage for
nft.repository.ts is >= 80%.
- Tests run successfully with
npm test.
Description
The
NFTRepository(src/modules/nft/repositories/nft.repository.ts) is responsible for persisting and retrieving NFT entities.To ensure correctness and reliability, we need to add comprehensive tests with special focus on how the repository handles references to NFTs (IDs, user ownership, relations).
This will provide confidence in NFT persistence logic and act as documentation for how NFTs are referenced throughout the system.
What is expected
NFTRepositorycovering reference-related operations.INFTRepository).What should be modified
src/modules/nft/__tests__/repositories/nft.repository.test.tscreateNFT()– creates an NFT and returns its reference.getNFTById()– retrieves an NFT using its ID.getNFTByUserId()– retrieves NFTs owned by a specific user.deleteNFT()– removes an NFT and ensures the reference is gone..env.test).message-prisma.repository.test.tsvolunteer-prisma.repository.test.tsAcceptance criteria
src/modules/nft/__tests__/repositories/.NFTRepositoryare tested.nft.repository.tsis >= 80%.npm test.