mirror of
https://github.com/wassname/talk.git
synced 2026-08-09 12:30:42 +08:00
Updating tests.
This commit is contained in:
@@ -29,21 +29,23 @@ describe('itemActions', () => {
|
||||
],
|
||||
actions: [
|
||||
{
|
||||
type: 'like',
|
||||
id: '123',
|
||||
action_type: 'like',
|
||||
item_id: '123',
|
||||
count: 1,
|
||||
id: 'like_123',
|
||||
current_user: false
|
||||
},
|
||||
{
|
||||
type: 'flag',
|
||||
id: '456',
|
||||
action_type: 'flag',
|
||||
item_id: '456',
|
||||
count: 5,
|
||||
id: 'flag_456',
|
||||
current_user: true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
it('should get an stream from an asset_id and send the appropriate dispatches', () => {
|
||||
it('should get an stream from an asset_url and send the appropriate dispatches', () => {
|
||||
fetchMock.get('*', JSON.stringify(response));
|
||||
return actions.getStream(assetUrl)(store.dispatch)
|
||||
.then((res) => {
|
||||
|
||||
+2
-14
@@ -10,10 +10,6 @@ describe('Action: models', () => {
|
||||
action_type: 'flag',
|
||||
item_id: '123',
|
||||
item_type: 'comments'
|
||||
}, {
|
||||
action_type: 'like',
|
||||
item_id: '789',
|
||||
item_type: 'comments'
|
||||
}, {
|
||||
action_type: 'flag',
|
||||
item_id: '456',
|
||||
@@ -51,19 +47,11 @@ describe('Action: models', () => {
|
||||
describe('#getActionSummaries()', () => {
|
||||
it('should return properly formatted summaries from an array of item_ids', () => {
|
||||
return Action.getActionSummaries(['123', '789']).then((result) => {
|
||||
expect(result).to.have.length(3);
|
||||
expect(result).to.have.length(2);
|
||||
|
||||
const sorted = result.sort((a, b) => a.count - b.count);
|
||||
|
||||
expect(sorted[0]).to.deep.equal({
|
||||
action_type: 'like',
|
||||
count: 1,
|
||||
item_id: '789',
|
||||
item_type: 'comments',
|
||||
current_user: false
|
||||
});
|
||||
|
||||
expect(sorted[1]).to.deep.equal({
|
||||
action_type: 'like',
|
||||
count: 1,
|
||||
item_id: '123',
|
||||
@@ -71,7 +59,7 @@ describe('Action: models', () => {
|
||||
current_user: false
|
||||
});
|
||||
|
||||
expect(sorted[2]).to.deep.equal({
|
||||
expect(sorted[1]).to.deep.equal({
|
||||
action_type: 'flag',
|
||||
count: 2,
|
||||
item_id: '123',
|
||||
|
||||
Reference in New Issue
Block a user