gen-jhipster
Version:
VHipster - Spring Boot + Angular/React/Vue in one handy generator
36 lines (35 loc) • 1.06 kB
JavaScript
import { runResult } from "../helpers.js";
/**
* Requires a global `it` function to be available.
*
* @example
* it(..matchWrittenFiles('eureka', () => ['file'], true));
*/
export const matchWrittenFiles = (title, expectedFilesGetter, shouldMatch) => [
shouldMatch ? `writes ${title} files` : `doesn't write ${title} files`,
() => {
if (shouldMatch) {
runResult.assertFile(expectedFilesGetter());
}
else {
runResult.assertNoFile(expectedFilesGetter());
}
},
];
/**
* Requires a global `it` function to be available.
*
* @example
* it(..matchWrittenFiles('eureka', { 'generator-jhipster': { config: true } }, true));
*/
export const matchWrittenConfig = (title, config, shouldMatch) => [
shouldMatch ? `writes ${title} config` : `doesn't write ${title} config`,
() => {
if (shouldMatch) {
runResult.assertJsonFileContent('.yo-rc.json', config);
}
else {
runResult.assertNoJsonFileContent('.yo-rc.json', config);
}
},
];