mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
Add helper to run all tests in directory
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
require('./globals.helper');
|
||||
import {readdirSync} from 'fs';
|
||||
import {resolve} from 'path';
|
||||
|
||||
import i18n from '../../common/script/src/i18n';
|
||||
require('coffee-script');
|
||||
@@ -15,4 +17,15 @@ global.expectValidTranslationString = (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);
|
||||
}
|
||||
};
|
||||
|
||||
global.runTestsInDirectory = (directory) => {
|
||||
const CONTENT_TEST_PATH = './test/content/';
|
||||
let directoryPath = `${CONTENT_TEST_PATH}${directory}`;
|
||||
let files = readdirSync(directoryPath);
|
||||
|
||||
files.forEach((file) => {
|
||||
let filePath = resolve(`${directoryPath}/${file}`);
|
||||
require(filePath);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user