acvetkov / sinon-chrome

Testing chrome extensions with Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`chrome.alarms.getAll()` returns `undefined` instead of array of alarms

opened this issue · comments

chrome.alarms.getAll() should return an array of alarms. However, it is returning undefined using v3.0.1.

const chrome = require("sinon-chrome/extensions");

(async () => {
    let alarms = await chrome.alarms.getAll();
    console.log(alarms); // `undefined`

    await chrome.alarms.create("testAlarm", {
        delayInMinutes: 15
    });

    alarms = await chrome.alarms.getAll();
    console.log(alarms); // `undefined`

    let alarm = await chrome.alarms.get("testAlarm");
    console.log(alarm); // `undefined`
})();

Apologies. I did not realize these were API stubs, not for faking behavior.

Apologies. I did not realize these were API stubs, not for faking behavior.

so, is that all of the returning should be mocked by self?
And all of the returning should be mocked by .returns() ? is it right? thanks