smartsign/test/test.ts
2023-11-25 01:38:43 +01:00

27 lines
941 B
TypeScript

import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
import * as smartsign from '../ts/index.js';
import * as smartfile from '@push.rocks/smartfile';
import * as smartshell from '@push.rocks/smartshell';
tap.preTask('create signing certificate', async () => {
const certExists = await smartfile.fs.fileExists('./.nogit/certificate.p12');
console.log('certExists:', certExists);
if (!certExists) {
const smartshellInstance = new smartshell.Smartshell({
executor: 'bash',
});
await smartshellInstance.exec(`bash -x ./scripts/create.p12.sh`)
}
})
let testSmartSign: smartsign.SmartSign;
tap.test('should create a new SmartSign instance', async () => {
const certSmartfile = await smartfile.SmartFile.fromFilePath('./.nogit/certificate.p12');
testSmartSign = new smartsign.SmartSign(certSmartfile.contentBuffer);
expect(testSmartSign).toBeInstanceOf(smartsign.SmartSign);
})
await tap.start();