mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-07 05:52:57 +00:00
refactor: build system
This commit is contained in:
@@ -22,30 +22,28 @@ import {suite, test} from '@testdeck/mocha';
|
||||
import {Logger} from '@openstapps/logger';
|
||||
import {expect} from 'chai';
|
||||
import {mkdirSync, writeFileSync, unlinkSync, rmdirSync} from 'fs';
|
||||
import { resolve } from 'path';
|
||||
import { isFileType } from '../src/common.js';
|
||||
import {resolve} from 'path';
|
||||
import {isFileType} from '../src/common.js';
|
||||
|
||||
process.on('unhandledRejection', async (error) => {
|
||||
process.on('unhandledRejection', async error => {
|
||||
await Logger.error(error);
|
||||
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
|
||||
@suite
|
||||
export class CommonSpec {
|
||||
|
||||
@test
|
||||
async testSSLCert() {
|
||||
const testCertDir = resolve(__dirname, 'certs');
|
||||
mkdirSync(testCertDir);
|
||||
const notAnExptectedFileTypeFilePath = resolve(testCertDir, 'notAnExptectedFileType.txt');
|
||||
const anExptectedFileTypeFilePath = resolve(testCertDir, 'notARealCert.crt');
|
||||
writeFileSync(notAnExptectedFileTypeFilePath,'Test');
|
||||
writeFileSync(anExptectedFileTypeFilePath,'Test');
|
||||
writeFileSync(notAnExptectedFileTypeFilePath, 'Test');
|
||||
writeFileSync(anExptectedFileTypeFilePath, 'Test');
|
||||
|
||||
expect(isFileType(notAnExptectedFileTypeFilePath,'crt')).to.equal(false)
|
||||
expect(isFileType(anExptectedFileTypeFilePath,'crt')).to.equal(true)
|
||||
expect(isFileType(notAnExptectedFileTypeFilePath, 'crt')).to.equal(false);
|
||||
expect(isFileType(anExptectedFileTypeFilePath, 'crt')).to.equal(true);
|
||||
|
||||
unlinkSync(notAnExptectedFileTypeFilePath);
|
||||
unlinkSync(anExptectedFileTypeFilePath);
|
||||
|
||||
Reference in New Issue
Block a user