Skip to content

Commit

Permalink
chore(changeset): add notes to changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
valoriecarli committed Feb 27, 2024
1 parent 0fab90a commit d29cab9
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/funny-ways-clap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@commercetools-test-data/review': patch
---

Add CH preset for ReviewDraft
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;
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);
});
});
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;
4 changes: 3 additions & 1 deletion models/review/src/review-draft/presets/index.ts
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;

0 comments on commit d29cab9

Please sign in to comment.