acvetkov / sinon-chrome

Testing chrome extensions with Node.js
ISC License
435 stars 46 forks source link

chrome.storage.local.get not calling the callback #15

Closed raisen closed 8 years ago

raisen commented 8 years ago

When I invoke chrome.storage.local.get (string key, function callback), callback doesn't seem to be called. Is it supposed to be called?

acvetkov commented 8 years ago

@raisen hi!

We have supported chrome.storage namespace since 1.0.0 version. I have no problems with it.

function getData(key, callback) {
   return chrome.storage.local.get(key, callback);
}

describe.only('chrome.storage.local.get', function () {

   before(function () {
      chrome.storage.local.get.yields('1');
   });

   it('should returns 1', function () {
      getData('data', function (result) {
          console.log('result', result); // 1
          assert.equal(result, '1');
      });
   });
});

Can you show me your test case?

raisen commented 8 years ago

Oh, I see, I thought there was a dummy storage service implemented, but I have to specify that yields to a value first. Got it, thank you!