mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
fix integration tests and paths for client tests
This commit is contained in:
@@ -87,11 +87,9 @@
|
||||
"test:nodemon": "gulp test:nodemon",
|
||||
"coverage": "COVERAGE=true mocha --require register-handlers.js --reporter html-cov > coverage.html; open coverage.html",
|
||||
"sprites": "gulp sprites:compile",
|
||||
"client:dev": "node webpack/dev-server.js",
|
||||
"client:build": "gulp build:client",
|
||||
"client:unit": "cross-env NODE_ENV=test karma start test/client/unit/karma.conf.js --single-run",
|
||||
"client:unit:watch": "cross-env NODE_ENV=test karma start test/client/unit/karma.conf.js",
|
||||
"client:test": "npm run client:unit",
|
||||
"client:dev": "cd website/client && npm run serve",
|
||||
"client:build": "cd website/client && npm run build",
|
||||
"client:unit": "cd website/client && npm run test:unit",
|
||||
"start": "gulp nodemon",
|
||||
"postinstall": "gulp build",
|
||||
"apidoc": "gulp apidoc"
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
each,
|
||||
} from 'lodash';
|
||||
import { model as User } from '../../../../../website/server/models/user';
|
||||
import * as payments from '../../../../../website/server/libs/payments/payments';
|
||||
import payments from '../../../../../website/server/libs/payments/payments';
|
||||
|
||||
describe('POST /groups/:groupId/leave', () => {
|
||||
let typesOfGroups = {
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
sleep,
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
import { quests as questScrolls } from '../../../../../website/common/script/content';
|
||||
import { quests as questScrolls } from '../../../../../website/common/script/content/quests';
|
||||
import { chatModel as Chat } from '../../../../../website/server/models/message';
|
||||
import apiError from '../../../../../website/server/libs/apiError';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Avatar from 'client/components/avatar';
|
||||
import Avatar from '@/components/avatar';
|
||||
import Vue from 'vue';
|
||||
import generateStore from 'client/store';
|
||||
import generateStore from '@/store';
|
||||
|
||||
context('avatar.vue', () => {
|
||||
let Constructr;
|
||||
@@ -1,7 +1,7 @@
|
||||
import {mount} from '@vue/test-utils';
|
||||
import Vue from 'vue';
|
||||
|
||||
import CategoryTags from 'client/components/categories/categoryTags.vue';
|
||||
import CategoryTags from '@/components/categories/categoryTags.vue';
|
||||
|
||||
describe('Category Tags', () => {
|
||||
let wrapper;
|
||||
@@ -1,6 +1,6 @@
|
||||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
||||
import ChallengeDetailComponent from 'client/components/challenges/challengeDetail.vue';
|
||||
import Store from 'client/libs/store';
|
||||
import ChallengeDetailComponent from '@/components/challenges/challengeDetail.vue';
|
||||
import Store from '@/libs/store';
|
||||
|
||||
const localVue = createLocalVue();
|
||||
localVue.use(Store);
|
||||
@@ -1,6 +1,5 @@
|
||||
import Vue from 'vue';
|
||||
import MembersModalComponent from 'client/components/groups/membersModal.vue';
|
||||
/* eslint-disable no-skipped-tests */
|
||||
import MembersModalComponent from '@/components/groups/membersModal.vue';
|
||||
describe.skip('Members Modal Component', () => {
|
||||
describe('Party Sort', () => {
|
||||
let CTor;
|
||||
@@ -29,4 +28,3 @@ describe.skip('Members Modal Component', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
/* eslint-enable no-skipped-tests */
|
||||
@@ -1,5 +1,5 @@
|
||||
import Vue from 'vue';
|
||||
import MemberDetailsComponent from 'client/components/memberDetails.vue';
|
||||
import MemberDetailsComponent from '@/components/memberDetails.vue';
|
||||
|
||||
describe('Members Details Component', () => {
|
||||
let CTor;
|
||||
@@ -1,8 +1,8 @@
|
||||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
||||
import NotificationsComponent from 'client/components/notifications.vue';
|
||||
import Store from 'client/libs/store';
|
||||
import { hasClass } from 'client/store/getters/members';
|
||||
import { toNextLevel } from 'common/script/statHelpers';
|
||||
import NotificationsComponent from '@/components/notifications.vue';
|
||||
import Store from '@/libs/store';
|
||||
import { hasClass } from '@/store/getters/members';
|
||||
import { toNextLevel } from '@/../../common/script/statHelpers';
|
||||
|
||||
const localVue = createLocalVue();
|
||||
localVue.use(Store);
|
||||
@@ -1,6 +1,6 @@
|
||||
import { mount } from '@vue/test-utils';
|
||||
|
||||
import SidebarSection from 'client/components/sidebarSection.vue';
|
||||
import SidebarSection from '@/components/sidebarSection.vue';
|
||||
|
||||
describe('Sidebar Section', () => {
|
||||
let wrapper;
|
||||
@@ -1,10 +1,6 @@
|
||||
import { mount, createLocalVue } from '@vue/test-utils';
|
||||
|
||||
import TaskColumn from 'client/components/tasks/column.vue';
|
||||
|
||||
import Store from 'client/libs/store';
|
||||
|
||||
// eslint-disable no-exclusive-tests
|
||||
import TaskColumn from '@/components/tasks/column.vue';
|
||||
import Store from '@/libs/store';
|
||||
|
||||
const localVue = createLocalVue();
|
||||
localVue.use(Store);
|
||||
@@ -1,5 +1,5 @@
|
||||
import Vue from 'vue';
|
||||
import DrawerComponent from 'client/components/ui/drawer.vue';
|
||||
import DrawerComponent from '@/components/ui/drawer.vue';
|
||||
|
||||
describe('DrawerComponent', () => {
|
||||
it('sets the correct default data', () => {
|
||||
@@ -1,13 +0,0 @@
|
||||
import { expect } from 'chai'
|
||||
import { shallowMount } from '@vue/test-utils'
|
||||
import HelloWorld from '@/components/HelloWorld.vue'
|
||||
|
||||
describe('HelloWorld.vue', () => {
|
||||
it('renders props.msg when passed', () => {
|
||||
const msg = 'new message'
|
||||
const wrapper = shallowMount(HelloWorld, {
|
||||
propsData: { msg }
|
||||
})
|
||||
expect(wrapper.text()).to.include(msg)
|
||||
})
|
||||
})
|
||||
@@ -1,4 +1,4 @@
|
||||
import floorFilter from 'client/filters/floor';
|
||||
import floorFilter from '@/filters/floor';
|
||||
|
||||
describe('floor filter', () => {
|
||||
it('can floor a decimal number', () => {
|
||||
@@ -1,4 +1,4 @@
|
||||
import roundFilter from 'client/filters/round';
|
||||
import roundFilter from '@/filters/round';
|
||||
|
||||
describe('round filter', () => {
|
||||
it('can round a decimal number', () => {
|
||||
@@ -1,4 +1,4 @@
|
||||
import roundBigNumberFilter from 'client/filters/roundBigNumber';
|
||||
import roundBigNumberFilter from '@/filters/roundBigNumber';
|
||||
|
||||
describe('round big number filter', () => {
|
||||
it('can round a decimal number', () => {
|
||||
@@ -1,6 +1,6 @@
|
||||
import { asyncResourceFactory, loadAsyncResource } from 'client/libs/asyncResource';
|
||||
import { asyncResourceFactory, loadAsyncResource } from '@/libs/asyncResource';
|
||||
import axios from 'axios';
|
||||
import generateStore from 'client/store';
|
||||
import generateStore from '@/store';
|
||||
import { sleep } from '../../../../helpers/sleep';
|
||||
|
||||
describe('async resource', () => {
|
||||
@@ -1,4 +1,4 @@
|
||||
import deepFreeze from 'client/libs/deepFreeze';
|
||||
import deepFreeze from '@/libs/deepFreeze';
|
||||
|
||||
describe('deepFreeze', () => {
|
||||
it('deeply freezes an object', () => {
|
||||
@@ -1,4 +1,4 @@
|
||||
import {highlightUsers} from '../../../../../website/client/libs/highlightUsers';
|
||||
import {highlightUsers} from '@/libs/highlightUsers';
|
||||
import habiticaMarkdown from 'habitica-markdown';
|
||||
|
||||
describe('highlightUserAndEmail', () => {
|
||||
@@ -1,5 +1,5 @@
|
||||
import i18n from 'client/libs/i18n';
|
||||
import commoni18n from 'common/script/i18n';
|
||||
import i18n from '@/libs/i18n';
|
||||
import commoni18n from '@/../../common/script/i18n';
|
||||
import Vue from 'vue';
|
||||
|
||||
describe('i18n plugin', () => {
|
||||
@@ -1,6 +1,6 @@
|
||||
import Vue from 'vue';
|
||||
import StoreModule, { mapState, mapGetters, mapActions } from 'client/libs/store';
|
||||
import { flattenAndNamespace } from 'client/libs/store/helpers/internals';
|
||||
import StoreModule, { mapState, mapGetters, mapActions } from '@/libs/store';
|
||||
import { flattenAndNamespace } from '@/libs/store/helpers/internals';
|
||||
|
||||
describe('Store', () => {
|
||||
let store;
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
getTypeLabel,
|
||||
getFilterLabels,
|
||||
getActiveFilter,
|
||||
} from 'client/libs/store/helpers/filterTasks.js';
|
||||
} from '@/libs/store/helpers/filterTasks.js';
|
||||
|
||||
describe('Filter Category for Tasks', () => {
|
||||
describe('getTypeLabel', () => {
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
orderSingleTypeTasks,
|
||||
// orderMultipleTypeTasks,
|
||||
} from 'client/libs/store/helpers/orderTasks.js';
|
||||
} from '@/libs/store/helpers/orderTasks.js';
|
||||
|
||||
import shuffle from 'lodash/shuffle';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import groupsUtilities from 'client/mixins/groupsUtilities';
|
||||
import { TAVERN_ID } from 'common/script/constants';
|
||||
import generateStore from 'client/store';
|
||||
import groupsUtilities from '@/mixins/groupsUtilities';
|
||||
import { TAVERN_ID } from '@/../../common/script/constants';
|
||||
import generateStore from '@/store';
|
||||
import Vue from 'vue';
|
||||
|
||||
describe('Groups Utilities Mixin', () => {
|
||||
@@ -1,10 +1,10 @@
|
||||
import axios from 'axios';
|
||||
import generateStore from 'client/store';
|
||||
import generateStore from '@/store';
|
||||
|
||||
import content from 'common/script/content';
|
||||
import getItemInfo from 'common/script/libs/getItemInfo';
|
||||
import content from '@/../../common/script/content';
|
||||
import getItemInfo from '@/../../common/script/libs/getItemInfo';
|
||||
|
||||
import getOfficialPinnedItems from 'common/script/libs/getOfficialPinnedItems';
|
||||
import getOfficialPinnedItems from '@/../../common/script/libs/getOfficialPinnedItems';
|
||||
|
||||
describe('shops actions', () => {
|
||||
let store;
|
||||
@@ -1,5 +1,5 @@
|
||||
import axios from 'axios';
|
||||
import generateStore from 'client/store';
|
||||
import generateStore from '@/store';
|
||||
|
||||
describe('tasks actions', () => {
|
||||
let store;
|
||||
@@ -1,5 +1,5 @@
|
||||
import axios from 'axios';
|
||||
import generateStore from 'client/store';
|
||||
import generateStore from '@/store';
|
||||
|
||||
describe('user actions', () => {
|
||||
let store;
|
||||
@@ -1,4 +1,4 @@
|
||||
import { hasClass } from 'client/store/getters/members';
|
||||
import { hasClass } from '@/store/getters/members';
|
||||
|
||||
describe('hasClass getter', () => {
|
||||
it('returns false if level < 10', () => {
|
||||
@@ -1,4 +1,4 @@
|
||||
import generateStore from 'client/store';
|
||||
import generateStore from '@/store';
|
||||
|
||||
describe('canDelete getter', () => {
|
||||
it('cannot delete active challenge task', () => {
|
||||
@@ -1,4 +1,4 @@
|
||||
import generateStore from 'client/store';
|
||||
import generateStore from '@/store';
|
||||
|
||||
describe('getTagsFor getter', () => {
|
||||
it('returns the tags for a task', () => {
|
||||
@@ -1,4 +1,4 @@
|
||||
import generateStore from 'client/store';
|
||||
import generateStore from '@/store';
|
||||
|
||||
describe('getTaskClasses getter', () => {
|
||||
let store, getTaskClasses;
|
||||
@@ -1,4 +1,4 @@
|
||||
import generateStore from 'client/store';
|
||||
import generateStore from '@/store';
|
||||
|
||||
describe('Store Getters for Tasks', () => {
|
||||
let store, habits, dailys, todos, rewards;
|
||||
@@ -1,4 +1,4 @@
|
||||
import { data, gems, buffs, preferences, tasksOrder } from 'client/store/getters/user';
|
||||
import { data, gems, buffs, preferences, tasksOrder } from '@/store/getters/user';
|
||||
|
||||
context('user getters', () => {
|
||||
describe('data', () => {
|
||||
@@ -1,5 +1,5 @@
|
||||
import generateStore from 'client/store';
|
||||
import Store from 'client/libs/store';
|
||||
import generateStore from '@/store';
|
||||
import Store from '@/libs/store';
|
||||
|
||||
describe('Application store', () => {
|
||||
it('is an instance of Store', () => {
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"env": {
|
||||
"test": {
|
||||
"presets": [
|
||||
["es2015"],
|
||||
],
|
||||
plugins: [
|
||||
["istanbul"],
|
||||
],
|
||||
},
|
||||
},
|
||||
"presets": [
|
||||
["es2015", { modules: false }]
|
||||
],
|
||||
"plugins": [
|
||||
"transform-object-rest-spread",
|
||||
"syntax-async-functions",
|
||||
"syntax-dynamic-import",
|
||||
"transform-regenerator",
|
||||
],
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"extends": [
|
||||
"habitrpg/browser",
|
||||
"habitrpg/esnext"
|
||||
],
|
||||
"plugins": [
|
||||
"html"
|
||||
],
|
||||
"parser": "babel-eslint",
|
||||
"rules": {
|
||||
"strict": 0
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
# Running
|
||||
For information about installing and running Habitica locally, see [Setting up Habitica Locally](http://habitica.fandom.com/wiki/Setting_up_Habitica_Locally).
|
||||
|
||||
# Preparation Reading
|
||||
- Vue 2 (https://vuejs.org)
|
||||
|
||||
- Webpack (https://webpack.github.io/) is the build system and it includes plugins for code transformation, right now we have: BabelJS for ES6 transpilation, eslint for code style, less and postcss for css compilation. The code comes from https://github.com/vuejs-templates/webpack which is a Webpack template for Vue, with some small modifications to adapt it to our use case. Docs http://vuejs-templates.github.io/webpack/
|
||||
|
||||
- We're using `.vue` files that make it possible to have HTML, JS and CSS for each component together in a single location. They're implemented as a webpack plugin and the docs can be found here http://vue-loader.vuejs.org/en/
|
||||
|
||||
- SemanticUI is the UI framework http://semantic-ui.com/. So far I've only used the CSS part, it also has JS plugins but I've yet to use them. It supports theming so if it's not too difficult we'll want to customize the base theme with our own styles instead of writing CSS rules to override the original styling.
|
||||
|
||||
The code is in `/website/client`. We're using something very similar to Vuex (equivalent of React's Redux) for state management http://vuex.vuejs.org/en/index.html
|
||||
|
||||
The API is almost the same except that we don't use mutations but only actions because it would make it difficult to work with common code
|
||||
|
||||
The project is developed directly in the `develop` branch as long as we'll be able to avoid splitting it into a different branch.
|
||||
|
||||
So far most of the work has been on the template, so there's no complex logic to understand. The only thing I would suggest you to read about is Vuex for data management: it's basically a Flux implementation: there's a central store that hold the data for the entire app, and every change to the data must happen through an action, the data cannot be mutated directly.
|
||||
|
||||
For further resources, see [Guidance for Blacksmiths](http://habitica.fandom.com/wiki/Guidance_for_Blacksmiths), and in particular the ["Website Technology Stack" section](http://habitica.fandom.com/wiki/Guidance_for_Blacksmiths#Website_Technology_Stack).
|
||||
Reference in New Issue
Block a user