mirror of
https://github.com/wassname/talk.git
synced 2026-07-05 23:13:24 +08:00
Retrieving counts and displaying new comments to user.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import {Map} from 'immutable';
|
||||
import {expect} from 'chai';
|
||||
import assetReducer from '../../../../client/coral-framework/reducers/asset';
|
||||
import * as actions from '../../../../client/coral-framework/constants/asset';
|
||||
|
||||
describe ('coral-embed-stream assetReducer', () => {
|
||||
describe('UPDATE_COUNT_CACHE', () => {
|
||||
it('should update the count cache', () => {
|
||||
const action = {
|
||||
type: actions.UPDATE_COUNT_CACHE,
|
||||
id: '123',
|
||||
count: 456
|
||||
};
|
||||
const store = new Map({});
|
||||
const result = assetReducer(store, action);
|
||||
expect(result.getIn(['countCache', '123'])).to.equal(456);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,35 @@
|
||||
import {Map} from 'immutable';
|
||||
import {expect} from 'chai';
|
||||
import notificationReducer from '../../../../client/coral-framework/reducers/notification';
|
||||
import * as actions from '../../../../client/coral-framework/actions/notification';
|
||||
|
||||
describe ('notificationsReducer', () => {
|
||||
describe('ADD_NOTIFICATION', () => {
|
||||
it('should add a notification', () => {
|
||||
const action = {
|
||||
type: actions.ADD_NOTIFICATION,
|
||||
text: 'Test notification',
|
||||
notifType: 'test'
|
||||
};
|
||||
const store = new Map({});
|
||||
const result = notificationReducer(store, action);
|
||||
expect(result.get('text')).to.equal(action.text);
|
||||
expect(result.get('type')).to.equal(action.notifType);
|
||||
});
|
||||
});
|
||||
|
||||
describe('CLEAR_NOTIFICATION', () => {
|
||||
it('should clear a notification', () => {
|
||||
const action = {
|
||||
type: actions.CLEAR_NOTIFICATION
|
||||
};
|
||||
const store = new Map({
|
||||
text: 'Test notification',
|
||||
type: 'test'
|
||||
});
|
||||
const result = notificationReducer(store, action);
|
||||
expect(result.get('text')).to.equal('');
|
||||
expect(result.get('type')).to.equal('');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user