Fix/issues#1
Merged
Merged
Conversation
Improves test suite robustness by covering previously untested scenarios including non-existent state handling, factory lifecycle hooks (afterMake/afterCreate), missing DataSource error cases, and event emitter integration. Adds tests for seeders without order property and configurations with no seeders to ensure graceful handling of edge cases. Introduces UserFactoryWithHooks test helper to verify lifecycle hook functionality.
There was a problem hiding this comment.
Pull request overview
Updates the test suite and documentation to cover additional edge cases and integrations for @nestbolt/factory, including seeding behavior, factory hooks, and optional event emission.
Changes:
- Add tests for
seed()behavior with no seeders configured and seeders missing anorderproperty. - Add test coverage for factory builder behaviors (unknown named state,
afterMake/afterCreatehooks, andcreate()without aDataSource). - Update package/README description text and remove the README “Credits” section.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/seeder.spec.ts | Adds coverage for seed() edge cases (no seeders; default ordering). |
| test/helpers/test-entities.ts | Adds a test factory variant with afterMake/afterCreate hooks. |
| test/factory.service.spec.ts | Adds tests for FactoryNotInitializedException and EventEmitter integration. |
| test/factory-builder.spec.ts | Adds tests for unknown states, factory hooks, and missing DataSource error behavior. |
| package.json | Updates package description text. |
| README.md | Updates header description text and removes “Credits” section. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
5
to
+9
| import { DataSource } from "typeorm"; | ||
| import { FactoryService } from "../src/factory.service"; | ||
| import { FactoryBuilder } from "../src/factory-builder"; | ||
| import { FactoryNotRegisteredException } from "../src/exceptions/factory-not-registered.exception"; | ||
| import { FactoryNotInitializedException } from "../src/exceptions/factory-not-initialized.exception"; |
There was a problem hiding this comment.
DataSource is imported but never used in this spec file. With typescript-eslint recommended rules enabled, this will fail lint (no-unused-vars). Remove the unused import (or start using it in a test) to keep CI green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.