Skip to content

Commit bbde78f

Browse files
committed
fix(core): entry-item-repository tests
1 parent 1f7268b commit bbde78f

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

packages/core/gateways/evaluation/implementations.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ test.group('evaluation (unit)', () => {
6969
console.log([ { key: 'abc' } ])
7070
`)
7171

72-
expect(result.logs).toEqual(['Hello', '{"key":123}', '[{"key":"abc"}]'])
72+
expect(result.logs).toEqual([
73+
'Hello',
74+
JSON.stringify({ key: 123 }, null, 4),
75+
JSON.stringify([{ key: 'abc' }], null, 4),
76+
])
7377
})
7478

7579
test('should "{name}" not be able to use import')

packages/core/repositories/item/implementations/entry-item-repository.spec.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ test.group('entry-item-repository (repository)', (group) => {
3030
.map((_, i) => String(i))
3131
.map((i) => drive.createDir(collection.path, i))
3232
.map(({ name }) => {
33-
const data = {
34-
gender: faker.name.gender(),
35-
age: faker.datatype.number({ min: 1, max: 99 }),
36-
}
33+
const item = new Item({}, name)
3734

38-
return new Item(data, name)
35+
item.gender = faker.name.gender()
36+
item.age = faker.datatype.number({ min: 1, max: 99 })
37+
38+
item._path = DirectoryEntry.normalize(collection.path, name)
39+
40+
return item
3941
})
4042

4143
saveMetas(items)
@@ -50,7 +52,11 @@ test.group('entry-item-repository (repository)', (group) => {
5052

5153
const result = await repository.show(entry.name)
5254

53-
expect(result).toEqual(new Item({}, entry.name))
55+
const item = new Item({}, entry.name)
56+
57+
item._path = DirectoryEntry.normalize(collection.path, item.id)
58+
59+
expect(result).toEqual(item)
5460
})
5561

5662
test('should show method throw an error if item not exists', async ({ expect }) => {

0 commit comments

Comments
 (0)