Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds schematics for service #9945

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JsantosDK
Copy link
Contributor

@JsantosDK JsantosDK commented Sep 7, 2024

Adds the schematic for a service, initial draft.
Starts the development of #6293

@JsantosDK
Copy link
Contributor Author

@satanTime, can you review this schematic to see if you agree?
If so, I will start working on the pipe schematic, followed by the directive and the component schematic.

@@ -0,0 +1,21 @@
import { MockBuilder,MockedComponentFixture, MockInstance, MockRender, } from 'ng-mocks';

import { <%= classify(name)%>Service } from './<%= dasherize(name)%>.service';

Check notice

Code scanning / CodeQL

Syntax error Note test

Error: Identifier expected.
@@ -0,0 +1,21 @@
import { MockBuilder,MockedComponentFixture, MockInstance, MockRender, } from 'ng-mocks';

import { <%= classify(name)%>Service } from './<%= dasherize(name)%>.service';

Check notice

Code scanning / CodeQL

Syntax error Note test

Error: Type expected.
@@ -0,0 +1,21 @@
import { MockBuilder,MockedComponentFixture, MockInstance, MockRender, } from 'ng-mocks';

import { <%= classify(name)%>Service } from './<%= dasherize(name)%>.service';

Check notice

Code scanning / CodeQL

Syntax error Note test

Error: Expression expected.
@@ -0,0 +1,21 @@
import { MockBuilder,MockedComponentFixture, MockInstance, MockRender, } from 'ng-mocks';

import { <%= classify(name)%>Service } from './<%= dasherize(name)%>.service';

Check notice

Code scanning / CodeQL

Syntax error Note test

Error: Declaration or statement expected.
@@ -0,0 +1,21 @@
import { MockBuilder,MockedComponentFixture, MockInstance, MockRender, } from 'ng-mocks';

import { <%= classify(name)%>Service } from './<%= dasherize(name)%>.service';

Check notice

Code scanning / CodeQL

Syntax error Note test

Error: Unexpected keyword or identifier.

describe('<%= classify(name)%>Service', () => {
let service: <%= classify(name)%>Service;
let fixture: MockedComponentFixture<<%= classify(name)%>Service>;

Check notice

Code scanning / CodeQL

Syntax error Note test

Error: Expression expected.

MockInstance.scope();

beforeEach(() => MockBuilder(<%= classify(name)%>Service));

Check notice

Code scanning / CodeQL

Syntax error Note test

Error: Type expected.

MockInstance.scope();

beforeEach(() => MockBuilder(<%= classify(name)%>Service));

Check notice

Code scanning / CodeQL

Syntax error Note test

Error: Expression expected.
beforeEach(() => MockBuilder(<%= classify(name)%>Service));

beforeEach(() => {
fixture = MockRender(<%= classify(name)%>Service);

Check notice

Code scanning / CodeQL

Syntax error Note test

Error: Type expected.
beforeEach(() => MockBuilder(<%= classify(name)%>Service));

beforeEach(() => {
fixture = MockRender(<%= classify(name)%>Service);

Check notice

Code scanning / CodeQL

Syntax error Note test

Error: Expression expected.
Copy link

codecov bot commented Sep 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (706c44f) to head (033c772).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #9945   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          227       227           
  Lines         4946      4946           
  Branches      1148      1148           
=========================================
  Hits          4946      4946           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@satanTime
Copy link
Member

They. Thanks a lot! I'm traveling this week and next week and will check asap once I'm back.

@JsantosDK
Copy link
Contributor Author

@satanTime I created a discussion so it will be easier to follow this.

If you agree, I would like to cancel this PR and split it into multiple:

  • A PR for the base schematics files, since these will be used regardless of the schematics templates;
  • A PR for the adjustments in the configurations:
    • Add the script to generate the schematics without navigating to the folder;
    • Add the schematics collection to the ngMocks project;
    • Exclude the schematic template files from the linting due to them containing a different syntax logic;
  • A PR for the actual schematic for the service, once a template has been defined;

Please let me know so I can make the adjustments.

@dolanmiu
Copy link

dolanmiu commented Oct 1, 2024

What is the status of this?

Been wanting this feature for a long time

@JsantosDK
Copy link
Contributor Author

There is a discussion on how this will work. You can see it in #9950.

There is some decisions that need to be made regarding the base schematic.

Currently, it is pending due to @satanTime not being available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants