master
1import path from 'node:path'
2import fs from 'node:fs'
3import os from 'node:os'
4import { describe, it, expect, afterAll } from 'vitest'
5import { getRepo } from './repo.js'
6import { createCtx } from './context.js'
7
8const temp = `${os.tmpdir()}/${Math.random().toString(36).slice(2)}`
9
10describe('repo API', () => {
11 const ctx = createCtx(['--repo', 'webpod/zurk', '--cwd', temp])
12 const repo = getRepo(ctx)
13
14 describe('syncRepo()', () => {
15 it('should sync the repo', () => {
16 repo.pull()
17 const pkgJson = JSON.parse(
18 fs.readFileSync(path.resolve(temp, 'repo/package.json'), 'utf-8'),
19 )
20 expect(pkgJson.name).toEqual('zurk')
21 })
22 })
23})
24
25afterAll(() => fs.rmdirSync(temp, { recursive: true }))