/* eslint-disable */ describe('loading', function () { it('single loading', function (done) { let store = window.cenote() .actions({ fetchData: () => new Promise(resolve => setTimeout(() => resolve(), 500)) }) if(store.loading('fetchData')) { return done(true) } store.fetchData() if(!store.loading('fetchData')) { return done(true) } setTimeout(() => { if(store.loading('fetchData')) { return done(true) } return done() }, 510) }) it('multiple loading', function (done) { let store = window.cenote() .actions({ fetchData: (self, time) => new Promise(resolve => setTimeout(() => resolve(), time)), }) if(store.loading('fetchData')) { return done(true) } store.fetchData(100) store.fetchData(400) if(!store.loading('fetchData')) { return done(true) } setTimeout(() => { if(!store.loading('fetchData')) { return done('Same action fetched at same time, one is done and another is not yet, cenote is showing that action is not waiting') } return done() }, 200) }) })