projectinfo/test/test.ts

33 lines
1014 B
TypeScript
Raw Normal View History

2018-09-02 12:08:15 +00:00
import { tap, expect } from '@pushrocks/tapbundle'
2017-09-22 21:52:28 +00:00
import projectinfo = require('../ts/index')
2017-09-22 21:46:43 +00:00
2016-11-26 13:45:56 +00:00
let path = require('path')
let testBasePath = path.resolve(__dirname)
2016-02-20 04:05:07 +00:00
2017-09-22 21:46:43 +00:00
let myNpm = new projectinfo.ProjectinfoNpm(testBasePath, { gitAccessToken: 'sometoken' })
tap.test('should have .packageJson', async () => {
expect(myNpm.packageJson).have.property('version', '1.0.0')
expect(myNpm.packageJson).have.property('name', 'testpackage')
})
2016-02-20 04:05:07 +00:00
2017-09-22 21:46:43 +00:00
tap.test('should have .version', async () => {
expect(myNpm).have.property('version', '1.0.0')
})
2016-02-21 16:17:31 +00:00
2017-09-22 21:46:43 +00:00
tap.test('should have .name', async () => {
expect(myNpm).have.property('name', 'testpackage')
})
2016-02-20 05:06:43 +00:00
2017-09-22 21:46:43 +00:00
tap.test('should have .license', async () => {
expect(myNpm).have.property('license', 'MIT')
})
tap.test('should have .git', async () => {
expect(myNpm.git.httpsUrl).equal('https://sometoken@github.com/someuser/somerepo.git')
2016-11-26 13:45:56 +00:00
})
2017-09-22 21:46:43 +00:00
tap.test('should return a name', async () => {
expect(projectinfo.getNpmNameForDir(testBasePath)
).equal('testpackage')
})
tap.start()