aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/notice-controller-test.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-06-13 08:06:39 +0800
committerDan Finlay <dan@danfinlay.com>2017-06-13 08:17:16 +0800
commita741cc4fc4fb68e3f460c70ea848bdf3d2d2c894 (patch)
tree58652d4789e71a47a763096e746bd25904d91bfe /test/unit/notice-controller-test.js
parentd05d9a5f57b9311d6f29539233f9065330e8bda4 (diff)
parentbbe0c73dca45542b519036bec2bae5feb1e55485 (diff)
downloadtangerine-wallet-browser-a741cc4fc4fb68e3f460c70ea848bdf3d2d2c894.tar
tangerine-wallet-browser-a741cc4fc4fb68e3f460c70ea848bdf3d2d2c894.tar.gz
tangerine-wallet-browser-a741cc4fc4fb68e3f460c70ea848bdf3d2d2c894.tar.bz2
tangerine-wallet-browser-a741cc4fc4fb68e3f460c70ea848bdf3d2d2c894.tar.lz
tangerine-wallet-browser-a741cc4fc4fb68e3f460c70ea848bdf3d2d2c894.tar.xz
tangerine-wallet-browser-a741cc4fc4fb68e3f460c70ea848bdf3d2d2c894.tar.zst
tangerine-wallet-browser-a741cc4fc4fb68e3f460c70ea848bdf3d2d2c894.zip
Merge branch 'master' into AddTokenList
Diffstat (limited to 'test/unit/notice-controller-test.js')
-rw-r--r--test/unit/notice-controller-test.js71
1 files changed, 33 insertions, 38 deletions
diff --git a/test/unit/notice-controller-test.js b/test/unit/notice-controller-test.js
index ea37108bb..09eeda15c 100644
--- a/test/unit/notice-controller-test.js
+++ b/test/unit/notice-controller-test.js
@@ -1,42 +1,38 @@
const assert = require('assert')
-const extend = require('xtend')
-const rp = require('request-promise')
-const nock = require('nock')
const configManagerGen = require('../lib/mock-config-manager')
const NoticeController = require('../../app/scripts/notice-controller')
-const STORAGE_KEY = 'metamask-persistence-key'
-describe('notice-controller', function() {
+describe('notice-controller', function () {
var noticeController
- beforeEach(function() {
+ beforeEach(function () {
// simple localStorage polyfill
- let configManager = configManagerGen()
+ const configManager = configManagerGen()
noticeController = new NoticeController({
configManager: configManager,
})
})
- describe('notices', function() {
- describe('#getNoticesList', function() {
- it('should return an empty array when new', function(done) {
- var testList = [{
- id:0,
- read:false,
- title:"Futuristic Notice"
- }]
+ describe('notices', function () {
+ describe('#getNoticesList', function () {
+ it('should return an empty array when new', function (done) {
+ // const testList = [{
+ // id: 0,
+ // read: false,
+ // title: 'Futuristic Notice',
+ // }]
var result = noticeController.getNoticesList()
assert.equal(result.length, 0)
done()
})
})
- describe('#setNoticesList', function() {
+ describe('#setNoticesList', function () {
it('should set data appropriately', function (done) {
var testList = [{
- id:0,
- read:false,
- title:"Futuristic Notice"
+ id: 0,
+ read: false,
+ title: 'Futuristic Notice',
}]
noticeController.setNoticesList(testList)
var testListId = noticeController.getNoticesList()[0].id
@@ -45,12 +41,12 @@ describe('notice-controller', function() {
})
})
- describe('#updateNoticeslist', function() {
- it('should integrate the latest changes from the source', function(done) {
+ describe('#updateNoticeslist', function () {
+ it('should integrate the latest changes from the source', function (done) {
var testList = [{
- id:55,
- read:false,
- title:"Futuristic Notice"
+ id: 55,
+ read: false,
+ title: 'Futuristic Notice',
}]
noticeController.setNoticesList(testList)
noticeController.updateNoticesList().then(() => {
@@ -62,14 +58,14 @@ describe('notice-controller', function() {
})
it('should not overwrite any existing fields', function (done) {
var testList = [{
- id:0,
- read:false,
- title:"Futuristic Notice"
+ id: 0,
+ read: false,
+ title: 'Futuristic Notice',
}]
noticeController.setNoticesList(testList)
var newList = noticeController.getNoticesList()
assert.equal(newList[0].id, 0)
- assert.equal(newList[0].title, "Futuristic Notice")
+ assert.equal(newList[0].title, 'Futuristic Notice')
assert.equal(newList.length, 1)
done()
})
@@ -78,9 +74,9 @@ describe('notice-controller', function() {
describe('#markNoticeRead', function () {
it('should mark a notice as read', function (done) {
var testList = [{
- id:0,
- read:false,
- title:"Futuristic Notice"
+ id: 0,
+ read: false,
+ title: 'Futuristic Notice',
}]
noticeController.setNoticesList(testList)
noticeController.markNoticeRead(testList[0])
@@ -93,9 +89,9 @@ describe('notice-controller', function() {
describe('#getLatestUnreadNotice', function () {
it('should retrieve the latest unread notice', function (done) {
var testList = [
- {id:0,read:true,title:"Past Notice"},
- {id:1,read:false,title:"Current Notice"},
- {id:2,read:false,title:"Future Notice"},
+ {id: 0, read: true, title: 'Past Notice'},
+ {id: 1, read: false, title: 'Current Notice'},
+ {id: 2, read: false, title: 'Future Notice'},
]
noticeController.setNoticesList(testList)
var latestUnread = noticeController.getLatestUnreadNotice()
@@ -104,9 +100,9 @@ describe('notice-controller', function() {
})
it('should return undefined if no unread notices exist.', function (done) {
var testList = [
- {id:0,read:true,title:"Past Notice"},
- {id:1,read:true,title:"Current Notice"},
- {id:2,read:true,title:"Future Notice"},
+ {id: 0, read: true, title: 'Past Notice'},
+ {id: 1, read: true, title: 'Current Notice'},
+ {id: 2, read: true, title: 'Future Notice'},
]
noticeController.setNoticesList(testList)
var latestUnread = noticeController.getLatestUnreadNotice()
@@ -115,5 +111,4 @@ describe('notice-controller', function() {
})
})
})
-
})