Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #202 from desktop/misc-cleanup
Misc cleanup
- Loading branch information
Showing
9 changed files
with
129 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ on: | |
branches: | ||
- master | ||
tags: | ||
- "v*" | ||
- 'v*' | ||
pull_request: | ||
|
||
jobs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.vscode | ||
.prettierrc.yml | ||
benchmarks/ | ||
.gitattributes | ||
.yarnrc | ||
vendor/ | ||
yarn-error.log | ||
build | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
singleQuote: false | ||
singleQuote: true | ||
trailingComma: es5 | ||
semi: true | ||
semi: false | ||
proseWrap: always | ||
endOfLine: auto | ||
arrowParens: avoid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from "./registry"; | ||
export * from './registry' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,63 @@ | ||
import { enumerateValues, enumerateKeys, HKEY } from "../lib/index"; | ||
import { enumerateValues, enumerateKeys, HKEY } from '../lib/index' | ||
|
||
if (process.platform === "win32") { | ||
describe("enumerateValue", () => { | ||
it("can read strings from the registry", () => { | ||
if (process.platform === 'win32') { | ||
describe('enumerateValue', () => { | ||
it('can read strings from the registry', () => { | ||
const values = enumerateValues( | ||
HKEY.HKEY_LOCAL_MACHINE, | ||
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion" | ||
); | ||
'SOFTWARE\\Microsoft\\Windows\\CurrentVersion' | ||
) | ||
|
||
const programFilesDir = values.find(v => v.name == "ProgramFilesDir"); | ||
expect(programFilesDir!.type).toBe("REG_SZ"); | ||
expect(programFilesDir!.data).toContain(":\\Program Files"); | ||
const programFilesDir = values.find(v => v.name == 'ProgramFilesDir') | ||
expect(programFilesDir!.type).toBe('REG_SZ') | ||
expect(programFilesDir!.data).toContain(':\\Program Files') | ||
|
||
const programFilesPath = values.find(v => v.name == "ProgramFilesPath"); | ||
expect(programFilesPath!.type).toBe("REG_EXPAND_SZ"); | ||
expect(programFilesPath!.data).toBe("%ProgramFiles%"); | ||
}); | ||
const programFilesPath = values.find(v => v.name == 'ProgramFilesPath') | ||
expect(programFilesPath!.type).toBe('REG_EXPAND_SZ') | ||
expect(programFilesPath!.data).toBe('%ProgramFiles%') | ||
}) | ||
|
||
it("can read numbers from the registry", () => { | ||
it('can read numbers from the registry', () => { | ||
const values = enumerateValues( | ||
HKEY.HKEY_LOCAL_MACHINE, | ||
"SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting" | ||
); | ||
'SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting' | ||
) | ||
|
||
const serviceTimeout = values.find(v => v.name == "ServiceTimeout"); | ||
expect(serviceTimeout!.type).toBe("REG_DWORD"); | ||
expect(serviceTimeout!.data).toBe(60000); | ||
}); | ||
const serviceTimeout = values.find(v => v.name == 'ServiceTimeout') | ||
expect(serviceTimeout!.type).toBe('REG_DWORD') | ||
expect(serviceTimeout!.data).toBe(60000) | ||
}) | ||
|
||
it("can read values from HKCU", () => { | ||
it('can read values from HKCU', () => { | ||
const values = enumerateValues( | ||
HKEY.HKEY_CURRENT_USER, | ||
"SOFTWARE\\Microsoft\\Windows\\DWM" | ||
); | ||
|
||
const composition = values.find(v => v.name == "Composition"); | ||
expect(composition!.type).toBe("REG_DWORD"); | ||
expect(composition!.data).toBe(1); | ||
}); | ||
|
||
it("returns empty array when key is missing", () => { | ||
const values = enumerateValues(HKEY.HKEY_LOCAL_MACHINE, "blahblahblah"); | ||
|
||
expect(values).toEqual([]); | ||
}); | ||
}); | ||
describe("enumerateKeys", () => { | ||
it("can enumerate key names from the registry (No subkey)", () => { | ||
const values = enumerateKeys(HKEY.HKEY_LOCAL_MACHINE, null); | ||
|
||
expect(values.indexOf("HARDWARE")).toBeGreaterThanOrEqual(0); | ||
expect(values.indexOf("SOFTWARE")).toBeGreaterThanOrEqual(0); | ||
expect(values.indexOf("SYSTEM")).toBeGreaterThanOrEqual(0); | ||
}); | ||
it("can enumerate key names from the registry", () => { | ||
const values = enumerateKeys(HKEY.HKEY_LOCAL_MACHINE, "SOFTWARE"); | ||
|
||
expect(values.indexOf("Classes")).toBeGreaterThanOrEqual(0); | ||
expect(values.indexOf("Microsoft")).toBeGreaterThanOrEqual(0); | ||
}); | ||
}); | ||
'SOFTWARE\\Microsoft\\Windows\\DWM' | ||
) | ||
|
||
const composition = values.find(v => v.name == 'Composition') | ||
expect(composition!.type).toBe('REG_DWORD') | ||
expect(composition!.data).toBe(1) | ||
}) | ||
|
||
it('returns empty array when key is missing', () => { | ||
const values = enumerateValues(HKEY.HKEY_LOCAL_MACHINE, 'blahblahblah') | ||
|
||
expect(values).toEqual([]) | ||
}) | ||
}) | ||
describe('enumerateKeys', () => { | ||
it('can enumerate key names from the registry (No subkey)', () => { | ||
const values = enumerateKeys(HKEY.HKEY_LOCAL_MACHINE, null) | ||
|
||
expect(values.indexOf('HARDWARE')).toBeGreaterThanOrEqual(0) | ||
expect(values.indexOf('SOFTWARE')).toBeGreaterThanOrEqual(0) | ||
expect(values.indexOf('SYSTEM')).toBeGreaterThanOrEqual(0) | ||
}) | ||
it('can enumerate key names from the registry', () => { | ||
const values = enumerateKeys(HKEY.HKEY_LOCAL_MACHINE, 'SOFTWARE') | ||
|
||
expect(values.indexOf('Classes')).toBeGreaterThanOrEqual(0) | ||
expect(values.indexOf('Microsoft')).toBeGreaterThanOrEqual(0) | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters