Example #1
0
 it("should reject the promise if there is an error", () => {
     global.AsyncStorage.removeItem = sinon.spy(function (key, cb) {
         cb("error");
     });
     const ret = multiStorage.del("key");
     return expect(ret).to.be.rejectedWith("error");
 });
Example #2
0
 it("should resolve the promise if there isn't any error", () => {
     global.AsyncStorage.removeItem = sinon.spy(function (key, cb) {
         cb(undefined);
     });
     const ret = multiStorage.del("key");
     return expect(ret).to.become(undefined);
 });
Example #3
0
 it("should remove a value from the `genericStorage`", () => {
     multiStorage.del("key");
     expect(genericStorage.key).to.be.equal(undefined);
 });
Example #4
0
 it("should remove a value from the `react-native` storage", () => {
     AsyncStorage.removeItem = sinon.spy();
     multiStorage.del("key");
     expect(AsyncStorage.removeItem).to.be.calledWith("key");
 });
Example #5
0
 it("should remove a value from the `chrome` storage", () => {
     multiStorage.del("key");
     expect(chrome.storage.local.remove).to.be.calledWith("key");
 });
Example #6
0
 it("should remove a value from the `localStorage`", () => {
     del("key");
     expect(localStorage.key).to.be.equal(undefined);
 });