Skip to content

Commit

Permalink
fix: service-generators test
Browse files Browse the repository at this point in the history
  • Loading branch information
Fasosnql committed Nov 6, 2024
1 parent 6ace453 commit ebca20e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ import { logger, readJson, Tree } from '@nrwl/devkit';
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import serviceGenerator from './index';

jest.mock('@nrwl/workspace', () => ({
...jest.requireActual('@nrwl/workspace'),
getNpmScope: jest.fn().mockReturnValue('myorg'),
}));

describe('Service generator', () => {
let appTree: Tree;
let projectName: string;

beforeEach(async () => {
projectName = 'my-service';
appTree = createTreeWithEmptyWorkspace({layout: 'apps-libs'});
appTree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });

jest.spyOn(logger, 'warn').mockImplementation(() => 1);
jest.spyOn(logger, 'debug').mockImplementation(() => 1);
Expand Down
2 changes: 2 additions & 0 deletions packages/gene-tools/src/generators/service-generator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function createFiles(
options.targetLocation,
{
...schema,
npmScope: options.npmScope,
fileName: stringUtils.classify(schema.name),
lowerCaseFileName: stringUtils.camelize(schema.name),
tmpl: '',
Expand Down Expand Up @@ -95,6 +96,7 @@ export default async function (tree: Tree, schema: BrainlyServiceGenerator) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
/** @ts-ignore */
const npmScope = getNpmScope(tree);

/**
* @description
* Generating proper files based on the service type
Expand Down

0 comments on commit ebca20e

Please # to comment.