Skip to content

Commit 9193034

Browse files
committed
Add generic type parameter to unitRef.get() calls with tokens
- Change unitRef.get(DATABASE_TOKEN) to unitRef.get<Database>(DATABASE_TOKEN) - Improves type safety and consistency across all examples - Follows the pattern from inversify-sinon example
1 parent 5ad9287 commit 9193034

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

inversify-jest/src/user.sociable.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('User Service Unit Spec (Sociable Tests)', () => {
1515
.compile();
1616

1717
userService = unit;
18-
database = unitRef.get(DATABASE_TOKEN);
18+
database = unitRef.get<Database>(DATABASE_TOKEN);
1919
});
2020

2121
it('should validate and create user with real validation logic', async () => {

inversify-vitest/src/user.sociable.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('User Service Unit Spec (Sociable Tests)', () => {
1515
.compile();
1616

1717
userService = unit;
18-
database = unitRef.get(DATABASE_TOKEN);
18+
database = unitRef.get<Database>(DATABASE_TOKEN);
1919
});
2020

2121
it('should validate and create user with real validation logic', async () => {

nestjs-jest/src/user.sociable.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('User Service Unit Spec (Sociable Tests)', () => {
1515
.compile();
1616

1717
userService = unit;
18-
database = unitRef.get(DATABASE_TOKEN);
18+
database = unitRef.get<Database>(DATABASE_TOKEN);
1919
});
2020

2121
it('should validate and create user with real validation logic', async () => {

nestjs-sinon/src/user.sociable.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('User Service Unit Spec (Sociable Tests)', () => {
2424
.compile();
2525

2626
userService = unit;
27-
database = unitRef.get(DATABASE_TOKEN);
27+
database = unitRef.get<Database>(DATABASE_TOKEN);
2828
});
2929

3030
it('should validate and create user with real validation logic', async () => {

nestjs-vitest/src/user.sociable.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('User Service Unit Spec (Sociable Tests)', () => {
1515
.compile();
1616

1717
userService = unit;
18-
database = unitRef.get(DATABASE_TOKEN);
18+
database = unitRef.get<Database>(DATABASE_TOKEN);
1919
});
2020

2121
it('should validate and create user with real validation logic', async () => {

0 commit comments

Comments
 (0)