Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: TT-223-Consume-end-point-archive-customers
  • Loading branch information
jeffqev committed Apr 23, 2021
commit 69a63f95f03db4480443463c15ac266c32bdcf22
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</td>
<td class="col-2 text-center">
<button
class="btn"
class="btn btn-sm"
data-toggle="modal"
data-target="#deleteModal"
[ngClass]="customer.btnColor"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ describe('CustomerTableListComponent', () => {
expect(component.dtElement.dtInstance.then).toHaveBeenCalled();
});

it('openModal should set on true and display "Are you sure you want to archive activity"', () => {
it('openModal should set on true and display "Are you sure you want to archive customer"', () => {
const message = 'Are you sure you want to archive name?';
const itemData = {
id: '1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from './../../../../store/customer-management.actions';
import { ResetProjectToEdit, SetProjectToEdit } from '../../../projects/components/store/project.actions';
import { ResetProjectTypeToEdit, SetProjectTypeToEdit } from '../../../projects-type/store';
import { UnArchiveCustomer } from '../../../../store/customer-management.actions';
import { UnarchiveCustomer } from '../../../../store/customer-management.actions';

@Component({
selector: 'app-customer-list',
Expand Down Expand Up @@ -181,7 +181,7 @@ export class CustomerListComponent implements OnInit, OnDestroy, AfterViewInit {
this.openModal(item);
} else {
this.showModal = false;
this.store.dispatch(new UnArchiveCustomer(item.id));
this.store.dispatch(new UnarchiveCustomer(item.id));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,21 @@ describe('CustomerManagmentActions', () => {
expect(resetCustomerIdToEdit.type).toEqual(actions.CustomerManagementActionTypes.RESET_CUSTOMER_ID_TO_EDIT);
});

it('UnArchiveCustomer type is CustomerManagementActionTypes.UNARCHIVE_CUSTOMER', () => {
const unArchiveCustomer = new actions.UnArchiveCustomer('id_test');
it('UnarchiveCustomer type is CustomerManagementActionTypes.UNARCHIVE_CUSTOMER', () => {
const unArchiveCustomer = new actions.UnarchiveCustomer('id_test');
expect(unArchiveCustomer.type).toEqual(actions.CustomerManagementActionTypes.UNARCHIVE_CUSTOMER);
});

it('UnArchiveCustomerSuccess type is CustomerManagementActionTypes.UNARCHIVE_CUSTOMER_SUCCESS', () => {
const unArchiveCustomerSuccess = new actions.UnArchiveCustomerSuccess({
it('UnarchiveCustomerSuccess type is CustomerManagementActionTypes.UNARCHIVE_CUSTOMER_SUCCESS', () => {
const unArchiveCustomerSuccess = new actions.UnarchiveCustomerSuccess({
id: 'id_test',
status: 'active',
});
expect(unArchiveCustomerSuccess.type).toEqual(actions.CustomerManagementActionTypes.UNARCHIVE_CUSTOMER_SUCCESS);
});

it('UnArchiveCustomerFail type is CustomerManagementActionTypes.UNARCHIVE_CUSTOMER_FAIL', () => {
const unArchiveCustomerFail = new actions.UnArchiveCustomerFail('error');
it('UnarchiveCustomerFail type is CustomerManagementActionTypes.UNARCHIVE_CUSTOMER_FAIL', () => {
const unArchiveCustomerFail = new actions.UnarchiveCustomerFail('error');
expect(unArchiveCustomerFail.type).toEqual(actions.CustomerManagementActionTypes.UNARCHIVE_CUSTOMER_FAIL);
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,19 @@ export class ResetCustomerToEdit implements Action {
public readonly type = CustomerManagementActionTypes.RESET_CUSTOMER_ID_TO_EDIT;
}

export class UnArchiveCustomer implements Action {
export class UnarchiveCustomer implements Action {
public readonly type = CustomerManagementActionTypes.UNARCHIVE_CUSTOMER;

constructor(public payload: string) {}
}

export class UnArchiveCustomerSuccess implements Action {
export class UnarchiveCustomerSuccess implements Action {
public readonly type = CustomerManagementActionTypes.UNARCHIVE_CUSTOMER_SUCCESS;

constructor(public payload: Status) {}
}

export class UnArchiveCustomerFail implements Action {
export class UnarchiveCustomerFail implements Action {
public readonly type = CustomerManagementActionTypes.UNARCHIVE_CUSTOMER_FAIL;

constructor(public error: string) {}
Expand All @@ -133,6 +133,6 @@ export type CustomerManagementActions =
| UpdateCustomerFail
| SetCustomerToEdit
| ResetCustomerToEdit
| UnArchiveCustomer
| UnArchiveCustomerSuccess
| UnArchiveCustomerFail;
| UnarchiveCustomer
| UnarchiveCustomerSuccess
| UnarchiveCustomerFail;
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class CustomerEffects {
@Effect()
unarchiveCustomer$: Observable<Action> = this.actions$.pipe(
ofType(actions.CustomerManagementActionTypes.UNARCHIVE_CUSTOMER),
map((action: actions.UnArchiveCustomer) => ({
map((action: actions.UnarchiveCustomer) => ({
id: action.payload,
status: 'active',
})),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe('customerManagementReducer', () => {
});

it('on UnarchiveCustomer, isLoading is true', () => {
const action = new actions.UnArchiveCustomer('1');
const action = new actions.UnarchiveCustomer('1');
const state = customerManagementReducer(initialState, action);

expect(state.isLoading).toEqual(true);
Expand All @@ -151,7 +151,7 @@ describe('customerManagementReducer', () => {
};
const customerEdited: Status = { id: '1', status: 'active' };
const expectedCustomer = { name: 'aa', description: 'bb', tenant_id: 'cc', id: '1', status: 'active' };
const action = new actions.UnArchiveCustomerSuccess(customerEdited);
const action = new actions.UnarchiveCustomerSuccess(customerEdited);
const state = customerManagementReducer(currentState, action);

expect(state.data).toEqual([expectedCustomer]);
Expand All @@ -160,7 +160,7 @@ describe('customerManagementReducer', () => {
});

it('on UnarchiveCustomerFail, message equal to Something went wrong unarchiving customer!', () => {
const action = new actions.UnArchiveCustomerFail('error');
const action = new actions.UnarchiveCustomerFail('error');
const state = customerManagementReducer(initialState, action);

expect(state.message).toEqual('Something went wrong unarchiving customer!');
Expand Down