mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-04-14 19:47:03 +00:00
* Re-organize common folder * fix: Correct paths in tests * fix: move new content to proper folder * chore: Move audio folder to assets * Move sprites to sprites assets directory * Move css sprites to assets directory * Split out readmes for common code and sprites * Move images to assets directory * Move destinatin of shared browserified file * remove unused file * move compiled js to client-old * Fix karma tests * fix: Correct paths for sprites
102 lines
3.3 KiB
JavaScript
102 lines
3.3 KiB
JavaScript
import shared from '../../../website/common';
|
|
import {
|
|
generateUser,
|
|
} from '../../helpers/common.helper';
|
|
|
|
describe('shops', () => {
|
|
let user = generateUser();
|
|
|
|
describe('market', () => {
|
|
let shopCategories = shared.shops.getMarketCategories(user);
|
|
|
|
it('contains at least the 3 default categories', () => {
|
|
expect(shopCategories.length).to.be.greaterThan(2);
|
|
});
|
|
|
|
it('does not duplicate identifiers', () => {
|
|
let identifiers = Array.from(new Set(shopCategories.map(cat => cat.identifier)));
|
|
|
|
expect(identifiers.length).to.eql(shopCategories.length);
|
|
});
|
|
|
|
it('items contain required fields', () => {
|
|
_.each(shopCategories, (category) => {
|
|
_.each(category.items, (item) => {
|
|
expect(item).to.have.all.keys(['key', 'text', 'notes', 'value', 'currency', 'locked', 'purchaseType', 'class']);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('questShop', () => {
|
|
let shopCategories = shared.shops.getQuestShopCategories(user);
|
|
|
|
it('does not contain an empty category', () => {
|
|
_.each(shopCategories, (category) => {
|
|
expect(category.items.length).to.be.greaterThan(0);
|
|
});
|
|
});
|
|
|
|
it('does not duplicate identifiers', () => {
|
|
let identifiers = Array.from(new Set(shopCategories.map(cat => cat.identifier)));
|
|
|
|
expect(identifiers.length).to.eql(shopCategories.length);
|
|
});
|
|
|
|
it('items contain required fields', () => {
|
|
_.each(shopCategories, (category) => {
|
|
_.each(category.items, (item) => {
|
|
expect(item).to.have.all.keys('key', 'text', 'notes', 'value', 'currency', 'locked', 'purchaseType', 'boss', 'class', 'collect', 'drop', 'unlockCondition', 'lvl');
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('timeTravelers', () => {
|
|
let shopCategories = shared.shops.getTimeTravelersCategories(user);
|
|
|
|
it('does not contain an empty category', () => {
|
|
_.each(shopCategories, (category) => {
|
|
expect(category.items.length).to.be.greaterThan(0);
|
|
});
|
|
});
|
|
|
|
it('does not duplicate identifiers', () => {
|
|
let identifiers = Array.from(new Set(shopCategories.map(cat => cat.identifier)));
|
|
|
|
expect(identifiers.length).to.eql(shopCategories.length);
|
|
});
|
|
|
|
it('items contain required fields', () => {
|
|
_.each(shopCategories, (category) => {
|
|
_.each(category.items, (item) => {
|
|
expect(item).to.have.all.keys('key', 'text', 'value', 'currency', 'locked', 'purchaseType', 'class', 'notes', 'class');
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('seasonalShop', () => {
|
|
let shopCategories = shared.shops.getSeasonalShopCategories(user);
|
|
|
|
it('does not contain an empty category', () => {
|
|
_.each(shopCategories, (category) => {
|
|
expect(category.items.length).to.be.greaterThan(0);
|
|
});
|
|
});
|
|
|
|
it('does not duplicate identifiers', () => {
|
|
let identifiers = Array.from(new Set(shopCategories.map(cat => cat.identifier)));
|
|
|
|
expect(identifiers.length).to.eql(shopCategories.length);
|
|
});
|
|
|
|
it('items contain required fields', () => {
|
|
_.each(shopCategories, (category) => {
|
|
_.each(category.items, (item) => {
|
|
expect(item).to.have.all.keys('key', 'text', 'notes', 'value', 'currency', 'locked', 'purchaseType', 'specialClass', 'type');
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|