Fix key and registry tests to work on Windows 10#59
Open
RupW wants to merge 1 commit intoCatalystCode:masterfrom
Open
Fix key and registry tests to work on Windows 10#59RupW wants to merge 1 commit intoCatalystCode:masterfrom
RupW wants to merge 1 commit intoCatalystCode:masterfrom
Conversation
- Open keys in HKCR as read-only, not all access - Create a new key HKCU\Software\windows-registry-node for read/write tests. Note that this key is not cleaned up on test completion, in case the delete function deletes something it shouldn't! The file association test still attempts to write to HKCR and will fail.
Author
|
This doesn't yet work with |
|
For me the tests are failing later on diff --git i/test/mock/adv_api.js w/test/mock/adv_api.js
index f55dea9..1d148d3 100644
--- i/test/mock/adv_api.js
+++ w/test/mock/adv_api.js
@@ -26,12 +26,15 @@ function findValueInHash(value, hash) {
var keys = {
};
-keys[windef.HKEY.HKEY_CLASSES_ROOT] = {
- predefValue: true,
- open: false,
- values: {
- }
-};
+Object.keys(windef.HKEY).forEach(function (k) {
+ keys[windef.HKEY[k]] = {
+ predefValue: true,
+ open: false,
+ values: {
+ }
+ };
+});
+
var mockIndex = 0x00000001;
var advApi = {
@@ -203,6 +206,22 @@ var advApi = {
delete keys[hKey.address()];
return 0;
},
+ /*
+ LONG WINAPI RegDeleteValue(
+ _In_ HKEY hKey,
+ _In_opt_ LPCTSTR lpValueName
+ );
+ */
+ RegDeleteValueA: function (hKey, valueName) {
+ if (typeof hKey === 'number') {
+ assert(findValueInHash(hKey, windef.HKEY), 'Mock: Invalid predefined key specified');
+ } else {
+ assert(hKey.constructor === Buffer, 'Mock: hKey should be of type buffer if not a number');
+ }
+ assert(typeof valueName === 'string');
+ delete keys[hKey.address()].values[valueName];
+ return 0;
+ },
/*
LONG WINAPI RegCloseKey(
_In_ HKEY hKey |
4 tasks
Author
|
Thanks, and apologies I never came back to the file association or elevation tests myself. I had glanced at enhancing the mocks but I'd thought it needed more work than that, but that looks good to me! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I haven't fixed the file association or elevation tests though, which are still failing for me. The file association code tries to open HKCR as all access which fails for me even with elevation, and the elevation test times out before the confirmation dialog opens.