Skip to content

Commit 56b0846

Browse files
committed
fix(stories): realistic fileCountInfo mock
1 parent 3edfaef commit 56b0846

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

tests/component/files/domain/models/FilesCountInfoMother.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,37 @@ import { FileAccessOption, FileTag } from '../../../../../src/files/domain/model
55

66
export class FilesCountInfoMother {
77
static create(props?: Partial<FilesCountInfo>): FilesCountInfo {
8+
const total = props?.total ?? faker.datatype.number()
89
return {
910
total: faker.datatype.number(),
1011
perFileType: [
1112
{
1213
type: new FileType(faker.system.fileType()),
13-
count: faker.datatype.number()
14+
count: faker.datatype.number({ max: total })
1415
},
1516
{
1617
type: new FileType(faker.system.fileType()),
17-
count: faker.datatype.number()
18+
count: faker.datatype.number({ max: total })
1819
}
1920
],
2021
perAccess: [
2122
{
2223
access: faker.helpers.arrayElement(Object.values(FileAccessOption)),
23-
count: faker.datatype.number()
24+
count: faker.datatype.number({ max: total })
2425
},
2526
{
2627
access: faker.helpers.arrayElement(Object.values(FileAccessOption)),
27-
count: faker.datatype.number()
28+
count: faker.datatype.number({ max: total })
2829
}
2930
],
3031
perFileTag: [
3132
{
3233
tag: new FileTag(faker.lorem.word()),
33-
count: faker.datatype.number()
34+
count: faker.datatype.number({ max: total })
3435
},
3536
{
3637
tag: new FileTag(faker.lorem.word()),
37-
count: faker.datatype.number()
38+
count: faker.datatype.number({ max: total })
3839
}
3940
],
4041
...props

0 commit comments

Comments
 (0)