Skip to content

Commit

Permalink
Found a key
Browse files Browse the repository at this point in the history
  • Loading branch information
cb1kenobi committed Jul 16, 2024
1 parent 5fc6bdf commit 4ee1523
Showing 1 changed file with 4 additions and 27 deletions.
31 changes: 4 additions & 27 deletions test/get.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import fs from 'node:fs';
import { describe, expect, it } from 'vitest';
import winreglib from '../src/index.js';
const { spawnSync } = require('node:child_process');
import { spawn } from 'node:child_process';
import snooplogg from 'snooplogg';

const { log } = snooplogg('test:winreglib');
Expand Down Expand Up @@ -97,35 +96,13 @@ describe('get()', () => {
expect(value).toBeGreaterThanOrEqual(0);
});

it('should get an 64-bit integer value', { timeout: 360000 }, async () => {
await new Promise<void>(resolve => {
const child = spawn(
'reg',
['query', 'HKLM\\Software\\Microsoft\\Windows\\CurrentVersion', '/s'],
{ stdio: 'pipe' }
);
const buffer: string[] = [];
child.stdout.on('data', data => {
const s = data.toString();
if (buffer.length > 10) {
buffer.unshift();
}
buffer.push(s);
if (s.includes('REG_QWORD')) {
console.log('-'.repeat(80));
console.log(buffer.join('\n'));
console.log('-'.repeat(80));
}
});
child.on('close', () => {
resolve();
});
});
it('should get an 64-bit integer value', async () => {
const value = winreglib.get(
'HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Diagnostics\\DiagTrack\\TraceManager',
'diagStartTime'
'HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\AppModel\\StateRepositoryStatus',
'MaintenanceLastPerformed'
) as number;
expect(value).toBeTypeOf('number');
expect(value).toBeGreaterThan(0);
});

it('should get a binary value', () => {
Expand Down

0 comments on commit 4ee1523

Please sign in to comment.