-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
24 lines (24 loc) · 851 Bytes
/
test.js
File metadata and controls
24 lines (24 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const util_1 = require("util");
const exec = util_1.promisify(require('child_process').exec);
const _1 = require(".");
function createCredentialTest(target) {
return exec(`cmdkey /generic:${target} /user:test /pass:test`);
}
function deleteCredentialTest(target) {
return exec(`cmdkey /delete ${target}`);
}
async function test() {
const target = `test${Date.now()}`;
await createCredentialTest(target);
const cred = await _1.getCredential(target);
assert.deepStrictEqual(cred, { username: 'test', password: 'test' }, 'Invalid Credential.');
await deleteCredentialTest(target);
}
function run() {
test()
.then(() => console.log('Test succesful!'), err => console.error('Error found', err));
}
run();