Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should have a `dismissAnnouncementBanner` action', function () {
const expectedValue = stringHash(PROJECT.configuration.announcement)
expect(store.dismissedAnnouncementBanner).to.equal(undefined)
store.dismissAnnouncementBanner()
expect(store.dismissedAnnouncementBanner).to.equal(expectedValue)
})
import stringHash from '@sindresorhus/string-hash'
import initStore from './initStore'
import UI from './UI'
const PROJECT = {
configuration: {
announcement: 'Nunc interdum justo fusce mi'
},
id: '2',
display_name: 'Hello',
slug: 'test/project'
}
const ANNOUNCEMENT_HASH = stringHash(PROJECT.configuration.announcement)
describe('Stores > UI', function () {
it('should export an object', function () {
expect(UI).to.be.an('object')
})
describe('mode', function () {
let store
beforeEach(function () {
store = UI.create()
})
it('should contain a mode property', function () {
expect(store.mode).to.be.ok()
})
dismissAnnouncementBanner() {
const { announcement } = getRoot(self).project.configuration
const announcementHash = stringHash(announcement)
self.dismissedAnnouncementBanner = announcementHash
},
get showAnnouncement () {
const { announcement } = getRoot(self).project.configuration
return announcement
? stringHash(announcement) !== self.dismissedAnnouncementBanner
: true
}
}))