issues.test.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. // TODO need to find a better way to test the 32bit/64bit specific scenarios
  2. var index = require('../index')
  3. var should = require('should')
  4. describe('regedit', function () {
  5. var baseKey = 'HKCU\\software\\ironSource\\regedit\\issues-test\\'
  6. var key
  7. // this test fails with a timeout because putValue callback is never invoked
  8. it('putValue with empty string for value fails silently #8', function (done) {
  9. index.createKey(key, function (err) {
  10. if (err) {
  11. return done(err)
  12. }
  13. var values = {}
  14. values[key] = {'valName': {value: '', type: 'REG_SZ'}}
  15. index.putValue(values, function (err) {
  16. if (err) {
  17. return done(err)
  18. }
  19. index.list(key, function(err, results) {
  20. if (err) {
  21. return done(err)
  22. }
  23. results.should.have.property(key)
  24. .which.have.property('values')
  25. .which.have.property('valName')
  26. .which.have.property('value', '')
  27. done()
  28. })
  29. })
  30. })
  31. })
  32. it('can putValue REG_DWORD > 0x7fffffff #21', function (done) {
  33. index.createKey(key, function (err) {
  34. if (err) {
  35. return done(err)
  36. }
  37. var values = {}
  38. values[key] = {'valName': {value: 0x80000000, type: 'REG_DWORD'}}
  39. index.putValue(values, function (err) {
  40. if (err) {
  41. return done(err)
  42. }
  43. index.list(key, function (err, results) {
  44. if (err) {
  45. return done(err)
  46. }
  47. results.should.have.property(key)
  48. .which.have.property('values')
  49. .which.have.property('valName')
  50. .which.have.property('value', 0x80000000)
  51. done()
  52. })
  53. })
  54. })
  55. })
  56. it('can putValue REG_QWORD < 9007199254740993 #21', function (done) {
  57. index.createKey(key, function (err) {
  58. if (err) {
  59. return done(err)
  60. }
  61. var values = {}
  62. values[key] = {'valName': {value: 9007199254740993, type: 'REG_QWORD'}}
  63. index.putValue(values, function (err) {
  64. if (err) {
  65. return done(err)
  66. }
  67. index.list(key, function (err, results) {
  68. if (err) {
  69. return done(err)
  70. }
  71. results.should.have.property(key)
  72. .which.have.property('values')
  73. .which.have.property('valName')
  74. .which.have.property('value', 9007199254740992)
  75. done()
  76. })
  77. })
  78. })
  79. })
  80. beforeEach(function () {
  81. key = baseKey + Date.now()
  82. })
  83. })