Files
habitica/test/helpers/content.helper.js
Matteo Pagliazzi ed0e4c6d20 Reorganize files under /src, separate express app in two apps, one for api v1 and v2 and the other \
for the upcoming api v3

Reorganize files under /src, separate express app in two apps, one for api v1 and v2 and the other for the upcoming api v3

move api v2 routes in a separate folder, rename apiv1 file for better readability, remove auth routes for api v1

move api-v2 controllers in subdirectory

move unorganized files to /libs

fix gulp requires and separate server in old (api v1 and v2) and new (api v3) app

fix require paths

fix require paths

fix require paths

put api v1 back

Reorganize files under /src and separate express app in one for api v1 and v2 and the other for v3
2015-11-02 17:43:32 +01:00

43 lines
1.3 KiB
JavaScript

require('./globals.helper');
import {each} from 'lodash';
import i18n from '../../common/script/src/i18n';
require('coffee-script');
i18n.translations = require('../../website/src/libs/i18n.js').translations;
export const STRING_ERROR_MSG = 'Error processing the string. Please see Help > Report a Bug.';
export const STRING_DOES_NOT_EXIST_MSG = /^String '.*' not found.$/;
export function expectValidTranslationString (attribute) {
expect(attribute).to.be.a('function');
let translatedString = attribute();
expect(translatedString).to.not.be.empty;
expect(translatedString).to.not.eql(STRING_ERROR_MSG);
expect(translatedString).to.not.match(STRING_DOES_NOT_EXIST_MSG);
};
export function describeEachItem (testDescription, set, cb, describeFunction) {
// describeFunction allows you to pass in 'only' or 'skip'
// as the last argument for writing/debugging tests.
// This should only be used with the helper functions .only and .skip below
let describeBlock = describe[describeFunction] || describe;
describeBlock(testDescription, () => {
each(set, (item, key) => {
describe(key, () => {
cb(item, key);
});
});
});
}
describeEachItem.only = (des, set, cb) => {
describeEachItem(des, set, cb, 'only');
}
describeEachItem.skip = (des, set, cb) => {
describeEachItem(des, set, cb, 'skip');
}