import { tap, expect } from '@git.zone/tstest/tapbundle'; import * as smartpath from '@push.rocks/smartpath'; import * as projectinfo from '../ts/index.js'; import * as path from 'path'; let testBasePath = path.resolve(smartpath.get.dirnameFromImportMetaUrl(import.meta.url)); let myNpm: projectinfo.ProjectinfoNpm; tap.test('should create ProjectinfoNpm instance', async () => { myNpm = await projectinfo.ProjectinfoNpm.create(testBasePath, { gitAccessToken: 'sometoken' }); }); tap.test('should have .packageJson', async () => { expect(myNpm.packageJson).property('version').toEqual('1.0.0'); expect(myNpm.packageJson).property('name').toEqual('testpackage'); }); tap.test('should have .version', async () => { expect(myNpm).property('version').toEqual('1.0.0'); }); tap.test('should have .name', async () => { expect(myNpm).property('name').toEqual('testpackage'); }); tap.test('should have .license', async () => { expect(myNpm).property('license').toEqual('MIT'); }); tap.test('should have .git', async () => { expect(myNpm.git!.httpsUrl).toEqual('https://sometoken@github.com/someuser/somerepo.git'); }); tap.test('should return a name', async () => { expect(await projectinfo.getNpmNameForDir(testBasePath)).toEqual('testpackage'); }); export default tap.start();