mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-08 22:42:54 +00:00
feat: tests
This commit is contained in:
@@ -1,43 +1,26 @@
|
||||
import * as chai from 'chai';
|
||||
import {expect} from 'chai';
|
||||
import chaiAsPromised from 'chai-as-promised';
|
||||
import {execSync} from 'child_process';
|
||||
import {suite, test} from '@testdeck/mocha';
|
||||
import {join} from 'path';
|
||||
import {dirSync} from 'tmp';
|
||||
import path from 'path';
|
||||
import {getUsedVersion, getUsedVersionMajorMinor} from '../src/tasks/get-used-version.js';
|
||||
|
||||
chai.use(chaiAsPromised);
|
||||
chai.should();
|
||||
|
||||
@suite()
|
||||
export class GetUsedVersionsSpec {
|
||||
@test
|
||||
async 'does not depend on core'() {
|
||||
return getUsedVersion(join(__dirname, '..'), '@openstapps/core').should.eventually.be.rejected;
|
||||
}
|
||||
describe('Verify Versions', function () {
|
||||
it('should not depend on core', async function () {
|
||||
await getUsedVersion(process.cwd(), '@openstapps/core').should.eventually.be.rejected;
|
||||
});
|
||||
|
||||
@test
|
||||
async 'not a Node.js project'() {
|
||||
return getUsedVersion(__dirname, '@openstapps/core').should.eventually.be.rejected;
|
||||
}
|
||||
it('should not be a Node.js project', async function () {
|
||||
await getUsedVersion(path.resolve(process.cwd(), '..'), '@openstapps/core').should.eventually.be.rejected;
|
||||
});
|
||||
|
||||
@test
|
||||
async 'has no dependencies'() {
|
||||
const temporaryDirectory = dirSync();
|
||||
it('should get used version', async function () {
|
||||
expect(await getUsedVersion(process.cwd(), 'mustache')).to.be.equal('4.2.0');
|
||||
});
|
||||
|
||||
execSync(`cd ${temporaryDirectory.name}; npm init -y`);
|
||||
|
||||
await getUsedVersion(temporaryDirectory.name, '@openstapps/core').should.eventually.be.rejected;
|
||||
}
|
||||
|
||||
@test
|
||||
async 'get used version'() {
|
||||
expect(await getUsedVersion(join(__dirname, '..'), '@krlwlfrt/async-pool')).to.be.equal('0.4.1');
|
||||
}
|
||||
|
||||
@test
|
||||
async 'get used version major minor'() {
|
||||
expect(await getUsedVersionMajorMinor(join(__dirname, '..'), '@krlwlfrt/async-pool')).to.be.equal('0.4');
|
||||
}
|
||||
}
|
||||
it('should get used version major minor', async function () {
|
||||
expect(await getUsedVersionMajorMinor(process.cwd(), 'mustache')).to.be.equal('4.2');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user