Skip to content

Commit d00285f

Browse files
committed
refactor(chrono): update init use-case tests
1 parent 908c67d commit d00285f

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

packages/chrono/playground/PlayDrive.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import fg from 'fast-glob'
66
export default class PlayDrive implements IDrive {
77
public basePath = path.resolve(__dirname, '.data')
88

9-
public resolve(...paths: string[]) {
10-
return path.resolve(this.basePath, ...paths)
9+
public resolve(...args: string[]) {
10+
return path.resolve(this.basePath, ...args)
1111
}
1212

1313
public async read(path: string) {
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
import { test, expect } from 'vitest'
22
import InitUseCase from './InitUseCase'
33
import InMemoryDrive from '../__tests__/InMemoryDrive'
4+
import HelperService from '../services/HelperService'
45

56
const drive = new InMemoryDrive()
67
const useCase = new InitUseCase(drive)
78

89
test('should init a workspace', async () => {
910
await useCase.execute()
1011

11-
const folders = [
12-
drive.resolve('.chrono'),
13-
drive.resolve('.chrono', 'objects'),
14-
drive.resolve('.chrono', 'blobs'),
15-
]
16-
1712
expect(drive.entries).toEqual([
18-
{ type: 'directory', path: folders[0] },
19-
{ type: 'directory', path: folders[1] },
20-
{ type: 'directory', path: folders[2] },
13+
{ type: 'directory', path: drive.resolve('.chrono') },
14+
{ type: 'directory', path: drive.resolve('.chrono', 'objects') },
15+
{ type: 'directory', path: drive.resolve('.chrono', 'blobs') },
16+
{ type: 'file', path: drive.resolve('.chrono', 'head'), content: HelperService.encode('') },
17+
{
18+
type: 'file',
19+
path: drive.resolve('.chrono', 'index'),
20+
content: HelperService.encode('[]'),
21+
},
2122
])
2223
})

packages/chrono/src/use-cases/InitUseCase.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export default class InitUseCase {
1515
await this.drive.mkdir('.chrono')
1616
await this.drive.mkdir('.chrono/objects')
1717
await this.drive.mkdir('.chrono/blobs')
18-
await this.drive.mkdir('.chrono/stage')
1918

2019
await this.drive.write('.chrono/head', HelperService.encode(''))
2120
await this.drive.write('.chrono/index', HelperService.encode('[]'))

0 commit comments

Comments
 (0)