Rohana / angular-state-management-v2

Updated version of angular-state-management
21 stars 18 forks source link

ng test fails with the following ts compile errors as loadCustomers is not defined #1

Open nagkumar opened 2 years ago

nagkumar commented 2 years ago

C:\temp\angular-state-management-v2>ng test Your global Angular CLI version (12.2.3) is greater than your local version (10.1.4). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false". Compiling @angular/core : es2015 as esm2015 Compiling @angular/compiler/testing : es2015 as esm2015 Compiling @angular/core/testing : es2015 as esm2015 Compiling @angular/common : es2015 as esm2015 Compiling @ngrx/store : es2015 as esm2015 Compiling @angular/platform-browser : es2015 as esm2015 Compiling @angular/platform-browser-dynamic : es2015 as esm2015 Compiling @angular/platform-browser/testing : es2015 as esm2015 Compiling @angular/platform-browser-dynamic/testing : es2015 as esm2015 30% building 7/7 modules 0 active30 08 2021 20:15:14.156:WARN [karma]: No captured browser, open http://localhost:9876/ 30 08 2021 20:15:14.162:INFO [karma-server]: Karma v5.0.9 server started at http://0.0.0.0:9876/ 30 08 2021 20:15:14.163:INFO [launcher]: Launching browsers Chrome with concurrency unlimited 30 08 2021 20:15:14.168:INFO [launcher]: Starting browser Chrome

ERROR in src/app/customer/store/action/customer.actions.spec.ts:5:25 - error TS2551: Property 'loadCustomers' does not exist on type 'typeof import("C:/temp/angular-state-management-v2/src/app/customer/store/action/customer.actions")'. Did you mean 'addCustomer'?

5 expect(fromCustomer.loadCustomers().type).toBe('[Customer] Load Customers');


  src/app/customer/store/action/customer.actions.ts:4:14
    4 export const addCustomer = createAction(
'addCustomer' is declared here.

ERROR in src/app/customer/store/action/customer.actions.spec.ts:5:25 - error TS2551: Property 'loadCustomers' does not exist on type 'typeof import("C:/temp/angular-state-management-v2/src/app/customer/store/action/customer.actions")'. Did you mean 'addCustomer'?

5 expect(fromCustomer.loadCustomers().type).toBe('[Customer] Load Customers');


  src/app/customer/store/action/customer.actions.ts:4:14
    4 export const addCustomer = createAction(
'addCustomer' is declared here.

30 08 2021 20:15:19.377:INFO [Chrome 92.0.4515.159 (Windows 10)]: Connected on socket _f7MYstUTjIv7mVYAAAA with id 75471210 Chrome 92.0.4515.159 (Windows 10): Executed 0 of 0 SUCCESS (0.015 secs / 0 secs) TOTAL: 0 SUCCESS TOTAL: 0 SUCCESS

nagkumar commented 2 years ago

Could pl. fix this..as writing unit tests and running them is too needed reference

nagkumar commented 2 years ago

This can be fixed by adding the method

export const loadCustomers = createAction('[Customer] Load Customer');

image