smartsign/test/test.ts

27 lines
941 B
TypeScript
Raw Normal View History

2023-11-24 23:52:56 +00:00
import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
2023-11-25 00:38:43 +00:00
import * as smartsign from '../ts/index.js';
import * as smartfile from '@push.rocks/smartfile';
import * as smartshell from '@push.rocks/smartshell';
2023-11-24 23:52:56 +00:00
2023-11-25 00:38:43 +00:00
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);
2023-11-24 23:52:56 +00:00
})
2023-11-25 00:38:43 +00:00
await tap.start();