-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(cart): fix factory partial types (#1834)
- Loading branch information
Showing
12 changed files
with
122 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
47 changes: 47 additions & 0 deletions
47
libs/cart/testing/src/factories/cart-shipping-information.factory.spec.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
|
||
import { DaffCartShippingRate } from '@daffodil/cart'; | ||
|
||
import { DaffCartShippingRateFactory } from './cart-shipping-rate.factory'; | ||
|
||
describe('Cart | Testing | Factories | CartShippingRateFactory', () => { | ||
|
||
let cartShippingRateFactory: DaffCartShippingRateFactory; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
providers: [DaffCartShippingRateFactory], | ||
}); | ||
|
||
cartShippingRateFactory = TestBed.inject(DaffCartShippingRateFactory); | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(cartShippingRateFactory).toBeTruthy(); | ||
}); | ||
|
||
describe('create', () => { | ||
|
||
let result: DaffCartShippingRate; | ||
|
||
beforeEach(() => { | ||
result = cartShippingRateFactory.create(); | ||
}); | ||
|
||
xit('should return a CartShippingRate with all required fields defined', () => { | ||
|
||
}); | ||
}); | ||
|
||
describe('createMany', () => { | ||
let result: DaffCartShippingRate[]; | ||
|
||
it('should create as many cart shipping rates as desired', () => { | ||
result = cartShippingRateFactory.createMany(2); | ||
expect(result.length).toEqual(2); | ||
|
||
result = cartShippingRateFactory.createMany(3); | ||
expect(result.length).toEqual(3); | ||
}); | ||
}); | ||
}); |
20 changes: 20 additions & 0 deletions
20
libs/cart/testing/src/factories/cart-shipping-information.factory.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { faker } from '@faker-js/faker/locale/en_US'; | ||
|
||
import { DaffCartShippingInformation } from '@daffodil/cart'; | ||
import { DaffModelFactory } from '@daffodil/core/testing'; | ||
|
||
import { MockCartShippingRate } from './cart-shipping-rate.factory'; | ||
|
||
export class MockCartShippingInformation extends MockCartShippingRate implements DaffCartShippingInformation { | ||
address_id = faker.datatype.uuid(); | ||
} | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class DaffCartShippingInformationFactory extends DaffModelFactory<DaffCartShippingInformation>{ | ||
constructor(){ | ||
super(MockCartShippingInformation); | ||
} | ||
} |
26 changes: 13 additions & 13 deletions
26
libs/cart/testing/src/factories/cart-shipping-rate.factory.spec.ts
This file contains 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
This file contains 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
This file contains 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