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
Next Next commit
fix: #571 test coverage
  • Loading branch information
scastillo-jp authored and Angeluz-07 committed Dec 11, 2020
commit ed579b6b48284d5f993469bd12d6c0913696566e
82 changes: 23 additions & 59 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
"@angular/platform-browser": "~10.2.2",
"@angular/platform-browser-dynamic": "~10.2.2",
"@angular/router": "~10.2.2",
"@azure/app-configuration": "^1.1.0",
"@azure/identity": "^1.1.0",
"@ngrx/effects": "^10.0.1",
"@ngrx/store": "^10.0.1",
"@ngrx/store-devtools": "^10.0.1",
"@types/datatables.net-buttons": "^1.4.3",
"angular-datatables": "^9.0.2",
"@azure/app-configuration": "^1.1.0",
"@azure/identity": "^1.1.0",
"bootstrap": "^4.4.1",
"datatables.net": "^1.10.21",
"datatables.net-buttons": "^1.6.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ describe('Reports Page', () => {
providers: [provideMockStore({ initialState: state })],
}).compileComponents();
store = TestBed.inject(MockStore);

}));

beforeEach(waitForAsync(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ToastrService } from 'ngx-toastr';
import { formatDate } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
import { DATE_FORMAT } from 'src/environments/environment';
import * as entryActions from '../../../time-clock/store/entry.actions';
import {Store} from '@ngrx/store';
import {EntryState} from '../../../time-clock/store/entry.reducer';
Expand All @@ -28,8 +29,8 @@ export class TimeRangeFormComponent implements OnInit {

setInitialDataOnScreen() {
this.reportForm.setValue({
startDate: formatDate(moment().startOf('week').toString(), 'yyyy-MM-dd', 'en'),
endDate: formatDate(moment().endOf('week').toString(), 'yyyy-MM-dd', 'en')
startDate: formatDate(moment().startOf('week').toString(), DATE_FORMAT, 'en'),
endDate: formatDate(moment().endOf('week').toString(), DATE_FORMAT, 'en')
});
this.onSubmit();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import { ProjectSelectedEvent } from './project-selected-event';
import { SaveEntryEvent } from './save-entry-event';
import { NgxMaterialTimepickerModule } from 'ngx-material-timepicker';

import { DATE_FORMAT } from 'src/environments/environment';
import { DATE_FORMAT_YEAR } from 'src/environments/environment';

describe('DetailsFieldsComponent', () => {
type Merged = TechnologyState & ProjectState & EntryState;
Expand Down Expand Up @@ -67,8 +69,8 @@ describe('DetailsFieldsComponent', () => {
project_name: '',
activity_id: '',
uri: '',
start_date: formatDate(new Date(), 'yyyy-MM-dd', 'en'),
end_date: formatDate(new Date(), 'yyyy-MM-dd', 'en'),
start_date: formatDate(new Date(), DATE_FORMAT, 'en'),
end_date: formatDate(new Date(), DATE_FORMAT, 'en'),
start_hour: '00:00',
end_hour: '00:00',
description: '',
Expand Down Expand Up @@ -179,8 +181,8 @@ describe('DetailsFieldsComponent', () => {
project_name: '',
activity_id: '',
uri: '',
start_date: formatDate(new Date(), 'yyyy-MM-dd', 'en'),
end_date: formatDate(new Date(), 'yyyy-MM-dd', 'en'),
start_date: formatDate(new Date(), DATE_FORMAT, 'en'),
end_date: formatDate(new Date(), DATE_FORMAT, 'en'),
start_hour: '00:00',
end_hour: '00:00',
description: '',
Expand Down Expand Up @@ -315,7 +317,7 @@ describe('DetailsFieldsComponent', () => {
it('displays error message when the date selected is in the future', () => {
spyOn(toastrServiceStub, 'error');

const futureDate = moment().add(1, 'days').format('YYYY-MM-DD');
const futureDate = moment().add(1, 'days').format(DATE_FORMAT_YEAR);
component.entryForm.setValue({ ...formValues, start_date: futureDate, end_date: futureDate });
component.onSubmit();

Expand All @@ -325,8 +327,8 @@ describe('DetailsFieldsComponent', () => {
it('when start_date is in the future and end_date is OK then throws an error', () => {
spyOn(toastrServiceStub, 'error');

const futureDate = moment().add(1, 'days').format('YYYY-MM-DD');
const currentDate = moment().format('YYYY-MM-DD');
const futureDate = moment().add(1, 'days').format(DATE_FORMAT_YEAR);
const currentDate = moment().format(DATE_FORMAT_YEAR);
component.entryForm.setValue({ ...formValues, start_date: futureDate, end_date: currentDate });
component.onSubmit();

Expand All @@ -336,8 +338,8 @@ describe('DetailsFieldsComponent', () => {
it('when start_date is OK and end_date is in the future then throws an error future', () => {
spyOn(toastrServiceStub, 'error');

const futureDate = moment().add(1, 'days').format('YYYY-MM-DD');
const currentDate = moment().format('YYYY-MM-DD');
const futureDate = moment().add(1, 'days').format(DATE_FORMAT_YEAR);
const currentDate = moment().format(DATE_FORMAT_YEAR);
component.entryForm.setValue({ ...formValues, start_date: currentDate, end_date: futureDate });
component.onSubmit();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { EntryActionTypes } from './../../../time-clock/store/entry.actions';
import { SaveEntryEvent } from './save-entry-event';
import { ProjectSelectedEvent } from './project-selected-event';
import { get } from 'lodash';
import { DATE_FORMAT } from 'src/environments/environment';


type Merged = TechnologyState & ProjectState & ActivityState & EntryState;
Expand Down Expand Up @@ -131,8 +132,8 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
project_id: this.entryToEdit.project_id,
activity_id: this.entryToEdit.activity_id,
description: this.entryToEdit.description,
start_date: formatDate(get(this.entryToEdit, 'start_date', '') , 'yyyy-MM-dd', 'en'),
end_date: formatDate(get(this.entryToEdit, 'end_date'), 'yyyy-MM-dd', 'en'),
start_date: formatDate(get(this.entryToEdit, 'start_date', '') ,DATE_FORMAT, 'en'),
end_date: formatDate(get(this.entryToEdit, 'end_date'), DATE_FORMAT, 'en'),
start_hour: formatDate(get(this.entryToEdit, 'start_date', '00:00'), 'HH:mm', 'en'),
end_hour: formatDate(get(this.entryToEdit, 'end_date', '00:00'), 'HH:mm', 'en'),
uri: this.entryToEdit.uri,
Expand All @@ -150,8 +151,8 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
project_id: '',
activity_id: '',
description: '',
start_date: formatDate(new Date(), 'yyyy-MM-dd', 'en'),
end_date: formatDate(new Date(), 'yyyy-MM-dd', 'en'),
start_date: formatDate(new Date(), DATE_FORMAT, 'en'),
end_date: formatDate(new Date(), DATE_FORMAT, 'en'),
start_hour: '00:00',
end_hour: '00:00',
uri: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('SidebarComponent', () => {
component.getSidebarItems();
const menuItems = component.itemsSidebar;

expect(menuItems.length).toBe(6);
expect(menuItems.length).toBe(7);
});

it('non admin users have two menu items', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NumberFormatter } from './../../formatters/number.formatter';
import { Pipe, PipeTransform } from '@angular/core';
import * as moment from 'moment';
import { DATE_FORMAT_YEAR } from 'src/environments/environment';
@Pipe({
name: 'substractDate'
})
Expand All @@ -12,8 +13,8 @@ export class SubstractDatePipe implements PipeTransform {
return '--:--';
}

const startDate = moment(substractDate, 'YYYY-MM-DD HH:mm:ss');
let endDate = moment(fromDate, 'YYYY-MM-DD HH:mm:ss');
const startDate = moment(substractDate, `${DATE_FORMAT_YEAR} HH:mm:ss`);
let endDate = moment(fromDate, `${DATE_FORMAT_YEAR} HH:mm:ss`);
let duration: moment.Duration = moment.duration(endDate.diff(startDate));

if (duration.asSeconds() > 60 && !displaySeconds) {
Expand Down

This file was deleted.

This file was deleted.

Loading