-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(changeset): add notes to changelog
- Loading branch information
1 parent
0fab90a
commit d29cab9
Showing
5 changed files
with
43 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@commercetools-test-data/review': patch | ||
--- | ||
|
||
Add CH preset for ReviewDraft |
7 changes: 7 additions & 0 deletions
7
models/review/src/review-draft/presets/change-history-data/index.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,7 @@ | ||
import withRatingGreaterThanOne from './with-ranking-greater-than-one'; | ||
|
||
const presets = { | ||
withRatingGreaterThanOne, | ||
}; | ||
|
||
export default presets; |
17 changes: 17 additions & 0 deletions
17
...review/src/review-draft/presets/change-history-data/with-ranking-greater-than-one.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,17 @@ | ||
import { TReviewDraft } from '../../../types'; | ||
import withRatingGreaterThanOne from './with-ranking-greater-than-one'; | ||
|
||
describe('ReviewDraft with a ranking preset of greater than 1', () => { | ||
it('should return a ranking between 2 & 100', () => { | ||
const ratingGreaterThanOne = | ||
withRatingGreaterThanOne().build<TReviewDraft>(); | ||
|
||
expect(ratingGreaterThanOne).toEqual( | ||
expect.objectContaining({ | ||
rating: expect.any(Number), | ||
}) | ||
); | ||
expect(ratingGreaterThanOne.rating).toBeGreaterThanOrEqual(2); | ||
expect(ratingGreaterThanOne.rating).toBeLessThanOrEqual(100); | ||
}); | ||
}); |
11 changes: 11 additions & 0 deletions
11
models/review/src/review-draft/presets/change-history-data/with-ranking-greater-than-one.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,11 @@ | ||
import type { TReviewDraftBuilder } from '../../../types'; | ||
import * as ReviewDraft from '../../index'; | ||
|
||
function ratingGreaterThanOne() { | ||
return Math.floor(Math.random() * 99) + 2; | ||
} | ||
|
||
const withRatingGreaterThanOne = (): TReviewDraftBuilder => | ||
ReviewDraft.random().rating(ratingGreaterThanOne()); | ||
|
||
export default withRatingGreaterThanOne; |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
const presets = {}; | ||
import changeHistoryData from './change-history-data'; | ||
|
||
const presets = { changeHistoryData }; | ||
|
||
export default presets; |