mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Client: Guild page and mix changes (#8533)
* update deps * add guilds page * improve karma conf, add tests for actions
This commit is contained in:
17
test/client/unit/specs/store/actions/guilds.js
Normal file
17
test/client/unit/specs/store/actions/guilds.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import { fetchAll as fetchAllGuilds } from 'client/store/actions/guilds';
|
||||
import axios from 'axios';
|
||||
import store from 'client/store';
|
||||
|
||||
describe('guilds actions', () => {
|
||||
it('fetchAll', async () => {
|
||||
const guilds = [{_id: 1}];
|
||||
sandbox
|
||||
.stub(axios, 'get')
|
||||
.withArgs('/api/v3/groups?type=publicGuilds')
|
||||
.returns(Promise.resolve({data: {data: guilds}}));
|
||||
|
||||
await fetchAllGuilds(store);
|
||||
|
||||
expect(store.state.guilds).to.equal(guilds);
|
||||
});
|
||||
});
|
||||
14
test/client/unit/specs/store/actions/tasks.js
Normal file
14
test/client/unit/specs/store/actions/tasks.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import { fetchUserTasks } from 'client/store/actions/tasks';
|
||||
import axios from 'axios';
|
||||
import store from 'client/store';
|
||||
|
||||
describe('tasks actions', () => {
|
||||
it('fetchUserTasks', async () => {
|
||||
const tasks = [{_id: 1}];
|
||||
sandbox.stub(axios, 'get').withArgs('/api/v3/tasks/user').returns(Promise.resolve({data: {data: tasks}}));
|
||||
|
||||
await fetchUserTasks(store);
|
||||
|
||||
expect(store.state.tasks).to.equal(tasks);
|
||||
});
|
||||
});
|
||||
14
test/client/unit/specs/store/actions/user.js
Normal file
14
test/client/unit/specs/store/actions/user.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import { fetch as fetchUser } from 'client/store/actions/user';
|
||||
import axios from 'axios';
|
||||
import store from 'client/store';
|
||||
|
||||
describe('user actions', () => {
|
||||
it('fetch', async () => {
|
||||
const user = {_id: 1};
|
||||
sandbox.stub(axios, 'get').withArgs('/api/v3/user').returns(Promise.resolve({data: {data: user}}));
|
||||
|
||||
await fetchUser(store);
|
||||
|
||||
expect(store.state.user).to.equal(user);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user