Skip to content

Conversation

@daros10
Copy link
Contributor

@daros10 daros10 commented Apr 17, 2020

Issue #87.

@codecov
Copy link

codecov bot commented Apr 17, 2020

Codecov Report

Merging #139 into master will decrease coverage by 0.24%.
The diff coverage is 90.38%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #139      +/-   ##
==========================================
- Coverage   92.42%   92.18%   -0.25%     
==========================================
  Files          47       50       +3     
  Lines         449      499      +50     
  Branches       27       32       +5     
==========================================
+ Hits          415      460      +45     
- Misses         26       29       +3     
- Partials        8       10       +2     
Impacted Files Coverage Δ
...omponents/customer-list/customer-list.component.ts 100.00% <ø> (ø)
...eate-project-type/create-project-type.component.ts 100.00% <ø> (ø)
...s/project-type-list/project-type-list.component.ts 100.00% <ø> (ø)
...ponents/create-project/create-project.component.ts 100.00% <ø> (ø)
.../components/project-list/project-list.component.ts 100.00% <ø> (ø)
...es/customer-management/pages/customer.component.ts 100.00% <ø> (ø)
...-management/store/customer-management.selectors.ts 50.00% <50.00%> (ø)
...r-management/store/customer-management.reducers.ts 62.50% <62.50%> (ø)
...info/components/create-customer/create-customer.ts 100.00% <100.00%> (ø)
...projects/management-customer-projects.component.ts 100.00% <100.00%> (ø)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3e9d621...b2a4427. Read the comment docs.

const messages$ = this.store.pipe(select(getStatusMessage));
this.saveSubscription = messages$.subscribe((valueMessage) => {
this.setStatusOnScreen(valueMessage);
console.log(valueMessage);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, delete this console.log

Copy link
Contributor Author

@daros10 daros10 Apr 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

createCustomer(customerData): Observable<any> {
const body = {
...customerData,
tenant_id: '4225ab1e-1033-4a5f-8650-0dd4950f38c8',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@enriquezrene Do we still need to set a tenant_id fake?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @daros10 needs to talk to @macrisguncay to understand how to get the tenant_id from the session_storage. Good catch @jorgecod, ty.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes was applied except this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daros10 you can get the real tenant id and bearer token from session storage, I implemented these methods in AzureAdB2CService, please check it and use them please.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you @macrisguncay , @enriquezrene all review requesting was applied.

import { Component, Input, Output, EventEmitter, OnDestroy, OnInit } from '@angular/core';
import { Store, select } from '@ngrx/store';
import { CustomerState, CreateCustomer } from 'src/app/modules/customer-management/store';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sort imports by module.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

import { TestBed, inject } from '@angular/core/testing';

import { CustomerService } from './customer.service';
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sort imports by module

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

import { MockStore, provideMockStore } from '@ngrx/store/testing';
import { CustomerState, CreateCustomer } from 'src/app/modules/customer-management/store';
import { FormBuilder } from '@angular/forms';
import { Customer } from 'src/app/modules/shared/models/customer.model';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The customer.model must be added in the index file in 'src/app/modules/shared/models/index.ts'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

import { CreateCustomerComponent } from './create-customer';
import { MockStore, provideMockStore } from '@ngrx/store/testing';
import { CustomerState, CreateCustomer } from 'src/app/modules/customer-management/store';
import { FormBuilder } from '@angular/forms';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sort imports by module

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

<div class="form-group">
<div
*ngIf="showAlert && messageToShow !== ''"
[ngClass]="{'bg-secondary': messageToShow == 'Customer create successfully!', 'bg-primary': messageToShow != 'Customer create successfully!'}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo:
Customer created successfully!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


component.setStatusOnScreen('Customer create successfully!');

expect(component.messageToShow).toEqual('Customer create successfully!');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Customer created successfully

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

expect(component.isActiveItemTabs).toBeTrue();
});

it('should be disabled tabs and show message Something went wrong creating customer! ', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it('should disable tabs and show a message "An error occurred, try again later." '

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

})
export class CreateCustomerComponent implements OnInit, OnDestroy {
customerForm: FormGroup;
@Input() isActiveItemTabs: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A better name would be:
areTabsActive

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

createCustomer(customerData): Observable<any> {
const body = {
...customerData,
tenant_id: '4225ab1e-1033-4a5f-8650-0dd4950f38c8',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @daros10 needs to talk to @macrisguncay to understand how to get the tenant_id from the session_storage. Good catch @jorgecod, ty.

...customerData,
tenant_id: this.service.getTenantId(),
};
console.log(this.service.getTenantId());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the console.log please.

@enriquezrene enriquezrene reopened this Apr 17, 2020
@enriquezrene enriquezrene merged commit a6f248b into master Apr 17, 2020
@enriquezrene enriquezrene deleted the 87-Save-customers branch April 17, 2020 23:06
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.

5 participants