Inital commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import * as assert from 'assert';
|
||||
import * as crypto from 'crypto';
|
||||
|
||||
const cryptoKey = require('../built/crypto_key');
|
||||
const getDiskUsage = require('../built/utils/disk-usage').default;
|
||||
|
||||
describe('Node.js 22 compatibility', () => {
|
||||
it('generates and derives PKCS#1 RSA keys', () => {
|
||||
const privateKey = cryptoKey.generate();
|
||||
const publicKey = cryptoKey.extractPublic(privateKey);
|
||||
|
||||
assert.ok(privateKey.startsWith('-----BEGIN RSA PRIVATE KEY-----'));
|
||||
assert.ok(publicKey.startsWith('-----BEGIN RSA PUBLIC KEY-----'));
|
||||
assert.equal(crypto.createPrivateKey(privateKey).asymmetricKeyType, 'rsa');
|
||||
assert.equal(crypto.createPublicKey(publicKey).asymmetricKeyType, 'rsa');
|
||||
});
|
||||
|
||||
it('reports finite non-negative disk usage values', () => {
|
||||
const usage = getDiskUsage();
|
||||
for (const key of ['available', 'free', 'total']) {
|
||||
assert.ok(Number.isFinite(usage[key]));
|
||||
assert.ok(usage[key] >= 0);
|
||||
}
|
||||
assert.ok(usage.available <= usage.free);
|
||||
assert.ok(usage.free <= usage.total);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user