mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-30 18:48:15 -05:00
28 lines
818 B
TypeScript
28 lines
818 B
TypeScript
import { fixtures } from '@pnpm/test-fixtures'
|
|
import fs from 'fs'
|
|
import path from 'path'
|
|
import { workWithInitModule, personToString } from '../lib/utils'
|
|
|
|
const f = fixtures(path.join(__dirname, '../fixtures'))
|
|
|
|
test('run the workWithInitModule function', async () => {
|
|
const dir = f.prepare('init-module')
|
|
const rawConfig = {
|
|
initVersion: '2.0.0',
|
|
initModule: '.pnpm-init.js',
|
|
}
|
|
expect(workWithInitModule(rawConfig)).toEqual({
|
|
initVersion: '2.0.0',
|
|
})
|
|
expect(fs.existsSync(path.resolve(dir, 'test.txt'))).toBeTruthy()
|
|
})
|
|
|
|
test('run the personToString function', () => {
|
|
const expectAuthor = 'pnpm <xxxxxx@pnpm.com> (https://www.github.com/pnpm)'
|
|
expect(personToString({
|
|
email: 'xxxxxx@pnpm.com',
|
|
name: 'pnpm',
|
|
url: 'https://www.github.com/pnpm',
|
|
})).toBe(expectAuthor)
|
|
})
|