Skip to content

Commit

Permalink
drop mockedGenerators
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Jul 4, 2024
1 parent 260ff98 commit 8b707a1
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 76 deletions.
9 changes: 0 additions & 9 deletions generators/server/__snapshots__/generator.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ exports[`generator - server composing databaseType option no with jwt should mat
"pom.xml": {
"stateCleared": "modified",
},
"src/main/docker/jib/entrypoint.sh": {
"stateCleared": "modified",
},
"src/main/java/com/mycompany/myapp/ApplicationWebXml.java": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -253,9 +250,6 @@ exports[`generator - server composing databaseType option no with oauth2 should
"pom.xml": {
"stateCleared": "modified",
},
"src/main/docker/jib/entrypoint.sh": {
"stateCleared": "modified",
},
"src/main/java/com/mycompany/myapp/ApplicationWebXml.java": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -489,9 +483,6 @@ exports[`generator - server composing databaseType option no with session should
"pom.xml": {
"stateCleared": "modified",
},
"src/main/docker/jib/entrypoint.sh": {
"stateCleared": "modified",
},
"src/main/java/com/mycompany/myapp/ApplicationWebXml.java": {
"stateCleared": "modified",
},
Expand Down
45 changes: 0 additions & 45 deletions generators/server/__test-support/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,7 @@ import assert from 'assert';

import { messageBrokerTypes, databaseTypes } from '../../../jdl/jhipster/index.js';
import {
GENERATOR_CUCUMBER,
GENERATOR_GATLING,
GENERATOR_SPRING_CACHE,
GENERATOR_SPRING_WEBSOCKET,
GENERATOR_SPRING_DATA_RELATIONAL,
GENERATOR_SPRING_DATA_CASSANDRA,
GENERATOR_SPRING_DATA_COUCHBASE,
GENERATOR_SPRING_DATA_MONGODB,
GENERATOR_MAVEN,
GENERATOR_LIQUIBASE,
GENERATOR_LANGUAGES,
GENERATOR_SPRING_CLOUD_STREAM,
GENERATOR_GRADLE,
GENERATOR_DOCKER,
GENERATOR_COMMON,
GENERATOR_JAVA,
GENERATOR_PROJECT_NAME,
GENERATOR_SERVER,
Expand All @@ -28,37 +14,6 @@ import {
const { KAFKA, PULSAR } = messageBrokerTypes;
const { SQL, COUCHBASE } = databaseTypes;

export const mockedGenerators = [
`jhipster:${GENERATOR_COMMON}`,
`jhipster:${GENERATOR_SPRING_DATA_COUCHBASE}`,
`jhipster:${GENERATOR_CUCUMBER}`,
`jhipster:${GENERATOR_DOCKER}`,
`jhipster:${GENERATOR_GATLING}`,
`jhipster:${GENERATOR_GRADLE}`,
`jhipster:${GENERATOR_GRADLE}:code-quality`,
`jhipster:${GENERATOR_GRADLE}:jib`,
`jhipster:${GENERATOR_GRADLE}:node-gradle`,
`jhipster:${GENERATOR_SPRING_CLOUD_STREAM}`,
// `jhipster:${GENERATOR_JAVA}`,
// `jhipster:${GENERATOR_JAVA}:domain`,
// `jhipster:${GENERATOR_JAVA}:bootstrap`,
`jhipster:${GENERATOR_JAVA}:build-tool`,
`jhipster:${GENERATOR_JAVA}:code-quality`,
`jhipster:${GENERATOR_JAVA}:node`,
`jhipster:${GENERATOR_LANGUAGES}`,
`jhipster:${GENERATOR_LIQUIBASE}`,
`jhipster:${GENERATOR_MAVEN}`,
`jhipster:${GENERATOR_MAVEN}:code-quality`,
`jhipster:${GENERATOR_MAVEN}:jib`,
`jhipster:${GENERATOR_MAVEN}:node`,
'jhipster:spring-cloud:gateway',
`jhipster:${GENERATOR_SPRING_DATA_CASSANDRA}`,
`jhipster:${GENERATOR_SPRING_DATA_MONGODB}`,
`jhipster:${GENERATOR_SPRING_DATA_RELATIONAL}`,
`jhipster:${GENERATOR_SPRING_CACHE}`,
`jhipster:${GENERATOR_SPRING_WEBSOCKET}`,
];

export const shouldComposeWithLiquibase = (testSample, runResultSupplier) => {
const liquibaseEnabled = typeof testSample === 'boolean' ? testSample : testSample?.databaseType === SQL;
if (liquibaseEnabled) {
Expand Down
16 changes: 8 additions & 8 deletions generators/server/generator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { snakeCase } from 'lodash-es';
import { shouldSupportFeatures, testBlueprintSupport, checkEnforcements } from '../../test/support/index.js';
import { defaultHelpers as helpers, result as runResult } from '../../testing/index.js';
import { GENERATOR_SERVER, GENERATOR_SPRING_BOOT } from '../generator-list.js';
import { mockedGenerators, shouldComposeWithCouchbase, shouldComposeWithSpringCloudStream } from './__test-support/index.js';
import { filterBasicServerGenerators, shouldComposeWithCouchbase, shouldComposeWithSpringCloudStream } from './__test-support/index.js';
import Generator from './index.js';

const __filename = fileURLToPath(import.meta.url);
Expand Down Expand Up @@ -52,7 +52,7 @@ describe(`generator - ${generator}`, () => {
messageBroker: 'no',
})
.withSkipWritingPriorities()
.withMockedGenerators(mockedGenerators);
.withMockedJHipsterGenerators({ filter: filterBasicServerGenerators });
});

shouldComposeWithSpringCloudStream(false, () => runResult);
Expand All @@ -66,7 +66,7 @@ describe(`generator - ${generator}`, () => {
messageBroker: 'kafka',
})
.withSkipWritingPriorities()
.withMockedGenerators(mockedGenerators);
.withMockedJHipsterGenerators({ filter: filterBasicServerGenerators });
});
shouldComposeWithSpringCloudStream(true, () => runResult);
});
Expand All @@ -79,7 +79,7 @@ describe(`generator - ${generator}`, () => {
messageBroker: 'pulsar',
})
.withSkipWritingPriorities()
.withMockedGenerators(mockedGenerators);
.withMockedJHipsterGenerators({ filter: filterBasicServerGenerators });
});
shouldComposeWithSpringCloudStream(true, () => runResult);
});
Expand All @@ -94,7 +94,7 @@ describe(`generator - ${generator}`, () => {
databaseType: 'no',
authenticationType: 'jwt',
})
.withMockedGenerators(mockedGenerators);
.withMockedJHipsterGenerators({ filter: filterBasicServerGenerators });
});

it('should match generated files', () => {
Expand All @@ -111,7 +111,7 @@ describe(`generator - ${generator}`, () => {
databaseType: 'no',
authenticationType: 'session',
})
.withMockedGenerators(mockedGenerators);
.withMockedJHipsterGenerators({ filter: filterBasicServerGenerators });
});

it('should match generated files', () => {
Expand All @@ -128,7 +128,7 @@ describe(`generator - ${generator}`, () => {
databaseType: 'no',
authenticationType: 'oauth2',
})
.withMockedGenerators(mockedGenerators);
.withMockedJHipsterGenerators({ filter: filterBasicServerGenerators });
});

it('should match generated files', () => {
Expand All @@ -146,7 +146,7 @@ describe(`generator - ${generator}`, () => {
databaseType: 'couchbase',
})
.withSkipWritingPriorities()
.withMockedGenerators(mockedGenerators);
.withMockedJHipsterGenerators({ filter: filterBasicServerGenerators });
});
shouldComposeWithCouchbase(true, () => runResult);
});
Expand Down
6 changes: 0 additions & 6 deletions generators/spring-boot/__snapshots__/generator.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ exports[`generator - spring-boot with jwt should match generated files snapshot
"pom.xml": {
"stateCleared": "modified",
},
"src/main/docker/jib/entrypoint.sh": {
"stateCleared": "modified",
},
"src/main/java/com/mycompany/myapp/ApplicationWebXml.java": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -388,9 +385,6 @@ exports[`generator - spring-boot with oauth2 should match generated files snapsh
"pom.xml": {
"stateCleared": "modified",
},
"src/main/docker/jib/entrypoint.sh": {
"stateCleared": "modified",
},
"src/main/java/com/mycompany/myapp/ApplicationWebXml.java": {
"stateCleared": "modified",
},
Expand Down
12 changes: 9 additions & 3 deletions generators/spring-boot/generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { defaultHelpers as helpers, runResult } from '../../testing/index.js';
import { shouldSupportFeatures, testBlueprintSupport, checkEnforcements } from '../../test/support/index.js';
import Generator from '../server/index.js';

import { mockedGenerators } from '../server/__test-support/index.js';
import { filterBasicServerGenerators } from '../server/__test-support/index.js';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
Expand All @@ -23,7 +23,10 @@ describe(`generator - ${generator}`, () => {

describe('with jwt', () => {
before(async () => {
await helpers.runJHipster(generator).withJHipsterConfig({ authenticationType: 'jwt' }).withMockedGenerators(mockedGenerators);
await helpers
.runJHipster(generator)
.withJHipsterConfig({ authenticationType: 'jwt' })
.withMockedJHipsterGenerators({ filter: filterBasicServerGenerators });
});

it('should match generated files snapshot', () => {
Expand All @@ -33,7 +36,10 @@ describe(`generator - ${generator}`, () => {

describe('with oauth2', () => {
before(async () => {
await helpers.runJHipster(generator).withJHipsterConfig({ authenticationType: 'oauth2' }).withMockedGenerators(mockedGenerators);
await helpers
.runJHipster(generator)
.withJHipsterConfig({ authenticationType: 'oauth2' })
.withMockedJHipsterGenerators({ filter: filterBasicServerGenerators });
});

it('should match generated files snapshot', () => {
Expand Down
8 changes: 3 additions & 5 deletions generators/spring-data-relational/sql-entities.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ import {
defaultHelpers as helpers,
runResult,
} from '../../testing/index.js';
import { mockedGenerators as serverGenerators } from '../server/__test-support/index.js';
import { filterBasicServerGenerators } from '../server/__test-support/index.js';

import { databaseTypes, cacheTypes } from '../../jdl/jhipster/index.js';
import { GENERATOR_SERVER, GENERATOR_SPRING_DATA_RELATIONAL } from '../generator-list.js';

const mockedGenerators = serverGenerators.filter(generator => generator !== `jhipster:${GENERATOR_SPRING_DATA_RELATIONAL}`);
import { GENERATOR_SERVER } from '../generator-list.js';

const { SQL: databaseType, H2_DISK, H2_MEMORY, POSTGRESQL, MARIADB, MYSQL, MSSQL, ORACLE } = databaseTypes;
const commonConfig = { databaseType, baseName: 'jhipster', nativeLanguage: 'en', languages: ['fr', 'en'] };
Expand Down Expand Up @@ -78,7 +76,7 @@ describe(`generator - ${databaseType} - entities`, () => {
.runJHipster(GENERATOR_SERVER)
.withJHipsterConfig(sampleConfig, entities)
.withOptions({ skipPriorities })
.withMockedGenerators(mockedGenerators);
.withMockedJHipsterGenerators({ except: ['jhipster:spring-data-relational'], filter: filterBasicServerGenerators });
});

it('should compose with jhipster:common', () => {
Expand Down

0 comments on commit 8b707a1

Please sign in to comment.