diff options
author | Thomas Huang <thomas.b.huang@gmail.com> | 2019-03-21 09:26:48 +0800 |
---|---|---|
committer | Thomas Huang <thomas.b.huang@gmail.com> | 2019-03-21 09:26:48 +0800 |
commit | c43374a553c28459be4cac116a72a4f34dddba72 (patch) | |
tree | e7584d60bf8617b742cdd09485f029e4d92f336d /test | |
parent | fc534b8041bbf69f3f7f8384554934d68a081835 (diff) | |
download | tangerine-wallet-browser-c43374a553c28459be4cac116a72a4f34dddba72.tar tangerine-wallet-browser-c43374a553c28459be4cac116a72a4f34dddba72.tar.gz tangerine-wallet-browser-c43374a553c28459be4cac116a72a4f34dddba72.tar.bz2 tangerine-wallet-browser-c43374a553c28459be4cac116a72a4f34dddba72.tar.lz tangerine-wallet-browser-c43374a553c28459be4cac116a72a4f34dddba72.tar.xz tangerine-wallet-browser-c43374a553c28459be4cac116a72a4f34dddba72.tar.zst tangerine-wallet-browser-c43374a553c28459be4cac116a72a4f34dddba72.zip |
Clear notices when setCompletedOnboarding is called
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/app/controllers/notice-controller-test.js | 26 | ||||
-rw-r--r-- | test/unit/ui/app/actions.spec.js | 24 |
2 files changed, 50 insertions, 0 deletions
diff --git a/test/unit/app/controllers/notice-controller-test.js b/test/unit/app/controllers/notice-controller-test.js index 834c88f7b..95e3ea9bd 100644 --- a/test/unit/app/controllers/notice-controller-test.js +++ b/test/unit/app/controllers/notice-controller-test.js @@ -39,6 +39,32 @@ describe('notice-controller', function () { }) }) + describe('#markAllNoticesRead', () => { + it('marks all notices read', (done) => { + const testList = [{ + id: 0, + read: false, + title: 'Notice 1', + }, { + id: 1, + read: false, + title: 'Notice 2', + }, { + id: 2, + read: false, + title: 'Notice 3', + }] + + noticeController.setNoticesList(testList) + + noticeController.markAllNoticesRead() + + const unreadNotices = noticeController.getUnreadNotices() + assert.equal(unreadNotices.length, 0) + done() + }) + }) + describe('#getNextUnreadNotice', function () { it('should retrieve the latest unread notice', function (done) { var testList = [ diff --git a/test/unit/ui/app/actions.spec.js b/test/unit/ui/app/actions.spec.js index 8d7de8b02..d27521088 100644 --- a/test/unit/ui/app/actions.spec.js +++ b/test/unit/ui/app/actions.spec.js @@ -1308,6 +1308,30 @@ describe('Actions', () => { }) }) + describe.only('#setCompletedOnboarding', () => { + let markAllNoticesReadSpy, completeOnboardingSpy + + beforeEach(() => { + markAllNoticesReadSpy = sinon.stub(background, 'markAllNoticesRead') + completeOnboardingSpy = sinon.stub(background, 'completeOnboarding') + }) + + after(() => { + markAllNoticesReadSpy.restore() + completeOnboardingSpy.restore() + }) + + it('', (done) => { + const store = mockStore() + store.dispatch(actions.setCompletedOnboarding()) + .then(() => { + assert.equal(markAllNoticesReadSpy.callCount, 1) + assert.equal(completeOnboardingSpy.callCount, 1) + }) + done() + }) + }) + describe('#updateNetworkNonce', () => { let getTransactionCountSpy |