parent
cd168a303d
commit
2e1cab23a4
7 changed files with 52 additions and 16 deletions
@ -0,0 +1,26 @@ |
||||
{ |
||||
// Use IntelliSense to learn about possible attributes. |
||||
// Hover to view descriptions of existing attributes. |
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 |
||||
"version": "0.2.0", |
||||
"configurations": [ |
||||
{ |
||||
"type": "node", |
||||
"request": "launch", |
||||
"name": "Mocha Test", |
||||
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", |
||||
"sourceMaps": true, |
||||
"skipFiles": ["<node_internals>/**"], |
||||
"args": [ |
||||
"-r", |
||||
"ts-node/register", |
||||
"--timeout", |
||||
"999999", |
||||
"--colors", |
||||
"${workspaceFolder}/test/**/*_spec.ts" |
||||
], |
||||
"internalConsoleOptions": "openOnSessionStart", |
||||
"cwd": "${workspaceFolder}" |
||||
} |
||||
] |
||||
} |
@ -1,11 +1,22 @@ |
||||
import "mocha"; |
||||
import * as crypto from "crypto"; |
||||
import { expect } from "chai"; |
||||
import * as sinon from "sinon"; |
||||
import { generatePassword } from "../lib/PasswordGenerator"; |
||||
|
||||
describe("PasswordGenerator", () => { |
||||
it("should return true for the first time", async () => { |
||||
const result = await generatePassword(10); |
||||
console.log(`before: "${result}"`) |
||||
expect(result).to.lengthOf(10); |
||||
}); |
||||
// it.only("should return true for the first time", async () => {
|
||||
// const testData = Buffer.from([31, 32, 126, 127]);
|
||||
// sinon.stub(crypto, "randomBytes")
|
||||
// .callsFake((size: number, cb: (err: Error | null, buf: Buffer) => void) => {
|
||||
// console.log("HEY")
|
||||
// cb(null, testData);
|
||||
// });
|
||||
// const result = await generatePassword(10);
|
||||
// expect(result).to.equal(" ~");
|
||||
// });
|
||||
}); |
Loading…
Reference in new issue