mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-10 03:32:52 +00:00
test: adjust tests
This commit is contained in:
@@ -12,11 +12,12 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {validateFiles} from '@openstapps/core-validator';
|
||||
import {validateFiles, writeReport} from '@openstapps/core-tools/lib/validate';
|
||||
import {Logger} from '@openstapps/logger';
|
||||
import {expect} from 'chai';
|
||||
import {mkdirSync} from 'fs';
|
||||
import {slow, suite, test, timeout} from 'mocha-typescript';
|
||||
import {join} from 'path';
|
||||
import {cwd} from 'process';
|
||||
import {join, resolve} from 'path';
|
||||
|
||||
const logger = new Logger();
|
||||
|
||||
@@ -29,6 +30,19 @@ process.on('unhandledRejection', (err) => {
|
||||
export class ValidateTestFiles {
|
||||
@test
|
||||
async validateTestFiles() {
|
||||
await validateFiles(join(cwd(), 'lib', 'schema'), join(cwd(), 'test', 'resources'), join(cwd(), 'report'));
|
||||
const errorsPerFile = await validateFiles(resolve('lib', 'schema'), resolve('test', 'resources'));
|
||||
|
||||
let unexpected = false;
|
||||
Object.keys(errorsPerFile).forEach((file) => {
|
||||
unexpected = unexpected || errorsPerFile[file].some((error) => !error.expected);
|
||||
});
|
||||
|
||||
expect(unexpected).to.be.equal(false);
|
||||
|
||||
mkdirSync('report', {
|
||||
recursive: true,
|
||||
});
|
||||
|
||||
await writeReport(join('report', 'index.html'), errorsPerFile);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user