Skip to content

Commit

Permalink
spec of mod.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
imcotton committed Mar 10, 2024
1 parent e919ce0 commit 6ba9dcb
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/mod.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import * as ast from 'jsr:@std/assert';
import { describe, it } from 'jsr:@std/testing/bdd';

import {
main,
} from '../src/mod.ts';





describe('main', function () {

it('throw without salt', async function () {
await ast.assertRejects(() => main([]));
});

it('throw without enough salt', async function () {
await ast.assertRejects(() => main([ '1234' ]));
});

it('OK at least 5 characters salt', async function () {

const { publicKey, fingerprint, privateKey } = await main([ 'abcde' ]);

ast.assertStringIncludes(publicKey, 'ssh-ed25519');
ast.assertStringIncludes(fingerprint, 'SHA256:');
ast.assertStringIncludes(privateKey, '---BEGIN OPENSSH PRIVATE KEY---');

});

});

0 comments on commit 6ba9dcb

Please sign in to comment.