<commit_before>/* global describe, beforeEach, it */

const path = require('path');
const assert = require('yeoman-assert');
const helpers = require('yeoman-test');
const fse = require('fs-extra');
const constants = require('../generators/generator-constants');

const TEST_DIR = constants.TEST_DIR;
const CLIENT_MAIN_SRC_DIR = constants.CLIENT_MAIN_SRC_DIR;
const CLIENT_TEST_SRC_DIR = constants.CLIENT_TEST_SRC_DIR;
const SERVER_MAIN_SRC_DIR = constants.SERVER_MAIN_SRC_DIR;
const SERVER_TEST_SRC_DIR = constants.SERVER_TEST_SRC_DIR;

const expectedFiles = {
    clientNg2: [
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo-detail.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo-dialog.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo-delete-dialog.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo.route.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo-dialog.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo-delete-dialog.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo-detail.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo.service.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/foo/foo-detail.component.spec.ts`,
    ],
    clientNg2WithSuffix: [
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management-detail.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management-dialog.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management-delete-dialog.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management.route.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management-dialog.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management-delete-dialog.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management-detail.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management.service.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/foo-management/foo-management-detail.component.spec.ts`,
    ],
    server: [
        '.jhipster/Foo.json',
        `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/domain/Foo.java`,
        `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/repository/FooRepository.java`,
        `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/web/rest/FooResource.java`,
        // SERVER_MAIN_RES_DIR + 'config/liquibase/changelog/20160120213555_added_entity_Foo.xml',
        `${SERVER_TEST_SRC_DIR}com/mycompany/myapp/web/rest/FooResourceIntTest.java`,
        `${TEST_DIR}gatling/user-files/simulations/FooGatlingTest.scala`
    ]
};

describe('JHipster generator entity for angularX', () => {
    describe('no dto, no service, no pagination', () => {
        beforeEach((done) => {
            helpers.run(require.resolve('../generators/entity'))
                .inTmpDir((dir) => {
                    fse.copySync(path.join(__dirname, '../test/templates/default-ng2'), dir);
                })
                .withArguments(['foo'])
                .withPrompts({
                    fieldAdd: false,
                    relationshipAdd: false,
                    dto: 'no',
                    service: 'no',
                    pagination: 'no'
                })
                .on('end', done);
        });

        it('creates expected default files', () => {
            assert.file(expectedFiles.server);
            assert.file(expectedFiles.clientNg2);
        });
    });

    describe('no dto, no service, with pagination', () => {
        beforeEach((done) => {
            helpers.run(require.resolve('../generators/entity'))
                .inTmpDir((dir) => {
                    fse.copySync(path.join(__dirname, '../test/templates/default-ng2'), dir);
                })
                .withArguments(['foo'])
                .withPrompts({
                    fieldAdd: false,
                    relationshipAdd: false,
                    dto: 'no',
                    service: 'no',
                    pagination: 'pagination'
                })
                .on('end', done);
        });

        it('creates expected default files', () => {
            assert.file(expectedFiles.server);
            assert.file(expectedFiles.clientNg2);
        });
    });

    describe('no dto, no service, with infinite-scroll', () => {
        beforeEach((done) => {
            helpers.run(require.resolve('../generators/entity'))
                .inTmpDir((dir) => {
                    fse.copySync(path.join(__dirname, '../test/templates/default-ng2'), dir);
                })
                .withArguments(['foo'])
                .withPrompts({
                    fieldAdd: false,
                    relationshipAdd: false,
                    dto: 'no',
                    service: 'no',
                    pagination: 'infinite-scroll'
                })
                .on('end', done);
        });

        it('creates expected default files', () => {
            assert.file(expectedFiles.server);
            assert.file(expectedFiles.clientNg2);
        });
    });

    describe('no dto, with serviceImpl, no pagination', () => {
        beforeEach((done) => {
            helpers.run(require.resolve('../generators/entity'))
                .inTmpDir((dir) => {
                    fse.copySync(path.join(__dirname, '../test/templates/default-ng2'), dir);
                })
                .withArguments(['foo'])
                .withPrompts({
                    fieldAdd: false,
                    relationshipAdd: false,
                    dto: 'no',
                    service: 'serviceImpl',
                    pagination: 'no'
                })
                .on('end', done);
        });

        it('creates expected default files', () => {
            assert.file(expectedFiles.server);
            assert.file(expectedFiles.clientNg2);
            assert.file([
                `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/service/FooService.java`,
                `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/service/impl/FooServiceImpl.java`
            ]);
        });
    });

    describe('with dto, service, no pagination', () => {
        beforeEach((done) => {
            helpers.run(require.resolve('../generators/entity'))
                .inTmpDir((dir) => {
                    fse.copySync(path.join(__dirname, '../test/templates/default-ng2'), dir);
                })
                .withArguments(['foo'])
                .withPrompts({
                    fieldAdd: false,
                    relationshipAdd: false,
                    dto: 'mapstruct',
                    service: 'serviceClass',
                    pagination: 'no'
                })
                .on('end', done);
        });

        it('creates expected default files', () => {
            assert.file(expectedFiles.server);
            assert.file(expectedFiles.clientNg2);
            assert.file([
                `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/service/dto/FooDTO.java`,
                `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/service/mapper/FooMapper.java`,
                `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/service/FooService.java`
            ]);
        });
    });

    describe('with dto, serviceImpl, with hazelcast, elasticsearch and noi18n', () => {
        beforeEach((done) => {
            helpers.run(require.resolve('../generators/entity'))
                .inTmpDir((dir) => {
                    fse.copySync(path.join(__dirname, '../test/templates/noi18n'), dir);
                })
                .withArguments(['foo'])
                .withPrompts({
                    fieldAdd: false,
                    relationshipAdd: false,
                    dto: 'yes',
                    service: 'serviceImpl',
                    pagination: 'infinite-scroll'
                })
                .on('end', done);
        });

        it('creates expected default files', () => {
            assert.file(expectedFiles.server);
            assert.file(expectedFiles.clientNg2);
            assert.noFile([
                `${CLIENT_MAIN_SRC_DIR}i18n/en/foo.json`,
                `${CLIENT_MAIN_SRC_DIR}i18n/fr/foo.json`
            ]);
        });
    });

    describe('with angulr suffix', () => {
        beforeEach((done) => {
            helpers.run(require.resolve('../generators/entity'))
                .inTmpDir((dir) => {
                    fse.copySync(path.join(__dirname, '../test/templates/default-ng2'), dir);
                })
                .withArguments(['foo'])
                .withOptions({ 'angular-suffix': 'management' })
                .withPrompts({
                    fieldAdd: false,
                    relationshipAdd: false,
                    dto: 'yes',
                    service: 'serviceImpl',
                    pagination: 'infinite-scroll'
                })
                .on('end', done);
        });

        it('creates expected default files', () => {
            assert.file(expectedFiles.server);
            assert.file(expectedFiles.clientNg2WithSuffix);
            assert.fileContent('.jhipster/Foo.json', 'angularJSSuffix');
        });
    });

    describe('JHipster generator entity with all languages', () => {
        describe('no dto, no service, no pagination', () => {
            beforeEach((done) => {
                helpers.run(require.resolve('../generators/entity'))
                    .inTmpDir((dir) => {
                        fse.copySync(path.join(__dirname, '../test/templates/all-languages'), dir);
                    })
                    .withArguments(['foo'])
                    .withPrompts({
                        fieldAdd: false,
                        relationshipAdd: false,
                        dto: 'no',
                        service: 'no',
                        pagination: 'no'
                    })
                    .on('end', done);
            });

            it('creates expected languages files', () => {
                constants.LANGUAGES.forEach((language) => {
                    assert.file([
                        `${CLIENT_MAIN_SRC_DIR}i18n/${language.value}/foo.json`
                    ]);
                });
            });
        });
    });

    describe('with dto, service, no pagination', () => {
        beforeEach((done) => {
            helpers.run(require.resolve('../generators/entity'))
                .inTmpDir((dir) => {
                    fse.copySync(path.join(__dirname, '../test/templates/default-ng2'), dir);
                })
                .withArguments(['foo'])
                .withPrompts({
                    fieldAdd: false,
                    relationshipAdd: false,
                    dto: 'mapstruct',
                    service: 'serviceClass',
                    pagination: 'no'
                })
                .on('end', done);
        });

        it('creates expected default files', () => {
            assert.file(expectedFiles.server);
            assert.file(expectedFiles.clientNg2);
            assert.file([
                `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/service/dto/FooDTO.java`,
                `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/service/mapper/FooMapper.java`,
                `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/service/FooService.java`
            ]);
        });
    });
});
<commit_msg>angular: add test for client root folder flag<commit_after>/* global describe, beforeEach, it */

const path = require('path');
const assert = require('yeoman-assert');
const helpers = require('yeoman-test');
const fse = require('fs-extra');
const constants = require('../generators/generator-constants');

const TEST_DIR = constants.TEST_DIR;
const CLIENT_MAIN_SRC_DIR = constants.CLIENT_MAIN_SRC_DIR;
const CLIENT_TEST_SRC_DIR = constants.CLIENT_TEST_SRC_DIR;
const SERVER_MAIN_SRC_DIR = constants.SERVER_MAIN_SRC_DIR;
const SERVER_TEST_SRC_DIR = constants.SERVER_TEST_SRC_DIR;

const expectedFiles = {
    clientNg2: [
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo-detail.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo-dialog.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo-delete-dialog.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo.route.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo-dialog.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo-delete-dialog.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo-detail.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo.service.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo/foo-popup.service.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/shared/model/foo.model.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/foo/foo-delete-dialog.component.spec.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/foo/foo-detail.component.spec.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/foo/foo-dialog.component.spec.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/foo/foo.component.spec.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/foo/foo.service.spec.ts`
    ],
    clientNg2WithSuffix: [
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management-detail.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management-dialog.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management-delete-dialog.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management.route.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management-dialog.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management-delete-dialog.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management-detail.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management.service.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/foo-management/foo-management-popup.service.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/shared/model/foo-management.model.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/foo-management/foo-management-delete-dialog.component.spec.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/foo-management/foo-management-detail.component.spec.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/foo-management/foo-management-dialog.component.spec.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/foo-management/foo-management.component.spec.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/foo-management/foo-management.service.spec.ts`
    ],
    clientNg2WithRootFolder: [
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo/foo.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo/foo-detail.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo/foo-dialog.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo/foo-delete-dialog.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo/foo.route.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo/foo.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo/foo-dialog.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo/foo-delete-dialog.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo/foo-detail.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo/foo.service.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo/foo-popup.service.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/shared/model/foo.model.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/test-root/foo/foo-delete-dialog.component.spec.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/test-root/foo/foo-detail.component.spec.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/test-root/foo/foo-dialog.component.spec.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/test-root/foo/foo.component.spec.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/test-root/foo/foo.service.spec.ts`
    ],
    clientNg2WithRootFolderAndSuffix: [
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo-management/foo-management.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo-management/foo-management-detail.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo-management/foo-management-dialog.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo-management/foo-management-delete-dialog.component.html`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo-management/foo-management.route.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo-management/foo-management.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo-management/foo-management-dialog.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo-management/foo-management-delete-dialog.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo-management/foo-management-detail.component.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo-management/foo-management.service.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/entities/test-root/foo-management/foo-management-popup.service.ts`,
        `${CLIENT_MAIN_SRC_DIR}app/shared/model/foo-management.model.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/test-root/foo-management/foo-management-delete-dialog.component.spec.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/test-root/foo-management/foo-management-detail.component.spec.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/test-root/foo-management/foo-management-dialog.component.spec.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/test-root/foo-management/foo-management.component.spec.ts`,
        `${CLIENT_TEST_SRC_DIR}spec/app/entities/test-root/foo-management/foo-management.service.spec.ts`
    ],
    server: [
        '.jhipster/Foo.json',
        `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/domain/Foo.java`,
        `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/repository/FooRepository.java`,
        `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/web/rest/FooResource.java`,
        // SERVER_MAIN_RES_DIR + 'config/liquibase/changelog/20160120213555_added_entity_Foo.xml',
        `${SERVER_TEST_SRC_DIR}com/mycompany/myapp/web/rest/FooResourceIntTest.java`,
        `${TEST_DIR}gatling/user-files/simulations/FooGatlingTest.scala`
    ]
};

describe('JHipster generator entity for angularX', () => {
    describe('no dto, no service, no pagination', () => {
        beforeEach((done) => {
            helpers.run(require.resolve('../generators/entity'))
                .inTmpDir((dir) => {
                    fse.copySync(path.join(__dirname, '../test/templates/default-ng2'), dir);
                })
                .withArguments(['foo'])
                .withPrompts({
                    fieldAdd: false,
                    relationshipAdd: false,
                    dto: 'no',
                    service: 'no',
                    pagination: 'no'
                })
                .on('end', done);
        });

        it('creates expected default files', () => {
            assert.file(expectedFiles.server);
            assert.file(expectedFiles.clientNg2);
        });
    });

    describe('no dto, no service, with pagination', () => {
        beforeEach((done) => {
            helpers.run(require.resolve('../generators/entity'))
                .inTmpDir((dir) => {
                    fse.copySync(path.join(__dirname, '../test/templates/default-ng2'), dir);
                })
                .withArguments(['foo'])
                .withPrompts({
                    fieldAdd: false,
                    relationshipAdd: false,
                    dto: 'no',
                    service: 'no',
                    pagination: 'pagination'
                })
                .on('end', done);
        });

        it('creates expected default files', () => {
            assert.file(expectedFiles.server);
            assert.file(expectedFiles.clientNg2);
        });
    });

    describe('no dto, no service, with infinite-scroll', () => {
        beforeEach((done) => {
            helpers.run(require.resolve('../generators/entity'))
                .inTmpDir((dir) => {
                    fse.copySync(path.join(__dirname, '../test/templates/default-ng2'), dir);
                })
                .withArguments(['foo'])
                .withPrompts({
                    fieldAdd: false,
                    relationshipAdd: false,
                    dto: 'no',
                    service: 'no',
                    pagination: 'infinite-scroll'
                })
                .on('end', done);
        });

        it('creates expected default files', () => {
            assert.file(expectedFiles.server);
            assert.file(expectedFiles.clientNg2);
        });
    });

    describe('no dto, with serviceImpl, no pagination', () => {
        beforeEach((done) => {
            helpers.run(require.resolve('../generators/entity'))
                .inTmpDir((dir) => {
                    fse.copySync(path.join(__dirname, '../test/templates/default-ng2'), dir);
                })
                .withArguments(['foo'])
                .withPrompts({
                    fieldAdd: false,
                    relationshipAdd: false,
                    dto: 'no',
                    service: 'serviceImpl',
                    pagination: 'no'
                })
                .on('end', done);
        });

        it('creates expected default files', () => {
            assert.file(expectedFiles.server);
            assert.file(expectedFiles.clientNg2);
            assert.file([
                `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/service/FooService.java`,
                `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/service/impl/FooServiceImpl.java`
            ]);
        });
    });

    describe('with dto, service, no pagination', () => {
        beforeEach((done) => {
            helpers.run(require.resolve('../generators/entity'))
                .inTmpDir((dir) => {
                    fse.copySync(path.join(__dirname, '../test/templates/default-ng2'), dir);
                })
                .withArguments(['foo'])
                .withPrompts({
                    fieldAdd: false,
                    relationshipAdd: false,
                    dto: 'mapstruct',
                    service: 'serviceClass',
                    pagination: 'no'
                })
                .on('end', done);
        });

        it('creates expected default files', () => {
            assert.file(expectedFiles.server);
            assert.file(expectedFiles.clientNg2);
            assert.file([
                `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/service/dto/FooDTO.java`,
                `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/service/mapper/FooMapper.java`,
                `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/service/FooService.java`
            ]);
        });
    });

    describe('with dto, serviceImpl, with hazelcast, elasticsearch and noi18n', () => {
        beforeEach((done) => {
            helpers.run(require.resolve('../generators/entity'))
                .inTmpDir((dir) => {
                    fse.copySync(path.join(__dirname, '../test/templates/noi18n'), dir);
                })
                .withArguments(['foo'])
                .withPrompts({
                    fieldAdd: false,
                    relationshipAdd: false,
                    dto: 'yes',
                    service: 'serviceImpl',
                    pagination: 'infinite-scroll'
                })
                .on('end', done);
        });

        it('creates expected default files', () => {
            assert.file(expectedFiles.server);
            assert.file(expectedFiles.clientNg2);
            assert.noFile([
                `${CLIENT_MAIN_SRC_DIR}i18n/en/foo.json`,
                `${CLIENT_MAIN_SRC_DIR}i18n/fr/foo.json`
            ]);
        });
    });

    describe('with angular suffix', () => {
        beforeEach((done) => {
            helpers.run(require.resolve('../generators/entity'))
                .inTmpDir((dir) => {
                    fse.copySync(path.join(__dirname, '../test/templates/default-ng2'), dir);
                })
                .withArguments(['foo'])
                .withOptions({ 'angular-suffix': 'management' })
                .withPrompts({
                    fieldAdd: false,
                    relationshipAdd: false,
                    dto: 'yes',
                    service: 'serviceImpl',
                    pagination: 'infinite-scroll'
                })
                .on('end', done);
        });

        it('creates expected default files', () => {
            assert.file(expectedFiles.server);
            assert.file(expectedFiles.clientNg2WithSuffix);
            assert.fileContent('.jhipster/Foo.json', 'angularJSSuffix');
        });
    });

    describe('JHipster generator entity with all languages', () => {
        describe('no dto, no service, no pagination', () => {
            beforeEach((done) => {
                helpers.run(require.resolve('../generators/entity'))
                    .inTmpDir((dir) => {
                        fse.copySync(path.join(__dirname, '../test/templates/all-languages'), dir);
                    })
                    .withArguments(['foo'])
                    .withPrompts({
                        fieldAdd: false,
                        relationshipAdd: false,
                        dto: 'no',
                        service: 'no',
                        pagination: 'no'
                    })
                    .on('end', done);
            });

            it('creates expected languages files', () => {
                constants.LANGUAGES.forEach((language) => {
                    assert.file([
                        `${CLIENT_MAIN_SRC_DIR}i18n/${language.value}/foo.json`
                    ]);
                });
            });
        });
    });

    describe('with client-root-folder', () => {
        beforeEach((done) => {
            helpers.run(require.resolve('../generators/entity'))
                .inTmpDir((dir) => {
                    fse.copySync(path.join(__dirname, '../test/templates/default-ng2'), dir);
                })
                .withArguments(['foo'])
                .withOptions({ 'client-root-folder': 'test-root' })
                .withPrompts({
                    fieldAdd: false,
                    relationshipAdd: false,
                    dto: 'yes',
                    service: 'serviceImpl',
                    pagination: 'infinite-scroll'
                })
                .on('end', done);
        });

        it('creates expected default files', () => {
            assert.file(expectedFiles.server);
            assert.file(expectedFiles.clientNg2WithRootFolder);
            assert.fileContent('.jhipster/Foo.json', 'clientRootFolder');
        });
    });

    describe('with client-root-folder and angular-suffix', () => {
        beforeEach((done) => {
            helpers.run(require.resolve('../generators/entity'))
                .inTmpDir((dir) => {
                    fse.copySync(path.join(__dirname, '../test/templates/default-ng2'), dir);
                })
                .withArguments(['foo'])
                .withOptions({ 'client-root-folder': 'test-root' })
                .withOptions({ 'angular-suffix': 'management' })
                .withPrompts({
                    fieldAdd: false,
                    relationshipAdd: false,
                    dto: 'yes',
                    service: 'serviceImpl',
                    pagination: 'infinite-scroll'
                })
                .on('end', done);
        });

        it('creates expected default files', () => {
            assert.file(expectedFiles.server);
            assert.file(expectedFiles.clientNg2WithRootFolderAndSuffix);
            assert.fileContent('.jhipster/Foo.json', 'clientRootFolder');
        });
    });
});

{'fraction_non_alphanumeric': 0.14541178098301685, 'fraction_numerical': 0.002974646328387119, 'mean_word_length': 1.897574664261375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 85, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6497192', 'n_tokens_mistral': 8393, 'n_tokens_neox': 8331, 'n_words': 863}