projectinfo/test/test.ts

32 lines
1.0 KiB
TypeScript
Raw Normal View History

2018-09-02 12:21:05 +00:00
import { tap, expect } from '@pushrocks/tapbundle';
import projectinfo = require('../ts/index');
2017-09-22 21:46:43 +00:00
2018-09-02 12:21:05 +00:00
let path = require('path');
let testBasePath = path.resolve(__dirname);
2016-02-20 04:05:07 +00:00
2018-09-02 12:21:05 +00:00
let myNpm = new projectinfo.ProjectinfoNpm(testBasePath, { gitAccessToken: 'sometoken' });
2017-09-22 21:46:43 +00:00
tap.test('should have .packageJson', async () => {
2018-09-02 12:21:05 +00:00
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 () => {
2018-09-02 12:21:05 +00:00
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 () => {
2018-09-02 12:21:05 +00:00
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 () => {
2018-09-02 12:21:05 +00:00
expect(myNpm).have.property('license', 'MIT');
});
2017-09-22 21:46:43 +00:00
tap.test('should have .git', async () => {
2018-09-02 12:21:05 +00:00
expect(myNpm.git.httpsUrl).equal('https://sometoken@github.com/someuser/somerepo.git');
});
2017-09-22 21:46:43 +00:00
tap.test('should return a name', async () => {
2018-09-02 12:21:05 +00:00
expect(projectinfo.getNpmNameForDir(testBasePath)).equal('testpackage');
});
2017-09-22 21:46:43 +00:00
2018-09-02 12:21:05 +00:00
tap.start();