Skip to content

Commit

Permalink
Add sequence usage to factories (#2756)
Browse files Browse the repository at this point in the history
... for upgradable packages factories and advisory factory
  • Loading branch information
dottorblaster authored and balanza committed Jul 9, 2024
1 parent e9ed9d3 commit 1cdaf29
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions assets/js/lib/test-utils/factories/relevantPatches.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Factory } from 'fishery';

export const advisoryType = ['security_advisory', 'bugfix', 'enhancement'];

export const relevantPatchFactory = Factory.define(() => ({
advisory_name: faker.animal.cat(),
export const relevantPatchFactory = Factory.define(({ sequence }) => ({
advisory_name: `${faker.animal.cat()}${sequence}`,
advisory_type: faker.helpers.arrayElement(advisoryType),
advisory_status: 'stable',
id: faker.number.int({ min: 2000, max: 5000 }),
Expand All @@ -13,8 +13,8 @@ export const relevantPatchFactory = Factory.define(() => ({
update_date: faker.date.anytime(),
}));

export const patchForPackageFactory = Factory.define(() => ({
advisory: faker.animal.cat(),
export const patchForPackageFactory = Factory.define(({ sequence }) => ({
advisory: `${faker.animal.cat()}${sequence}`,
type: faker.helpers.arrayElement(advisoryType),
synopsis: faker.lorem.sentence(),
issue_date: faker.date.anytime().toString(),
Expand Down
4 changes: 2 additions & 2 deletions assets/js/lib/test-utils/factories/upgradablePackage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { patchForPackageFactory } from './relevantPatches';
const releaseVersionFactory = () =>
`${faker.number.int({ min: 100000, max: 160000 })}.${faker.system.semver()}`;

export const upgradablePackageFactory = Factory.define(() => ({
export const upgradablePackageFactory = Factory.define(({ sequence }) => ({
from_epoch: faker.date.anytime(),
to_release: releaseVersionFactory(),
name: faker.word.noun(),
name: `${faker.word.noun()}${sequence}`,
from_release: releaseVersionFactory(),
to_epoch: faker.date.anytime(),
arch: faker.airline.flightNumber(),
Expand Down

0 comments on commit 1cdaf29

Please sign in to comment.