Skip to content

Commit

Permalink
fix all
Browse files Browse the repository at this point in the history
  • Loading branch information
duluca committed Sep 8, 2023
1 parent dcb3ece commit e1d5a27
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 56 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
"cypress:open": "cypress open",
"cypress:run": "cypress run",
"build:prod": "ng build --configuration production",
"build:all": "run-p -cs \"build:prod\" \"build:prod --project stage8\" \"build:prod --project stage10\" \"build:prod --project stage11\" \"build:prod --project stage12\"",
"build:integration": "cross-conf-env docker image build -f integration.Dockerfile . -t $npm_package_config_imageRepo:latest",
"test:prod": "npm test -- --browsers ChromiumNoSandbox --watch=false",
"test:ci": "ng test --browsers=ChromeHeadless --watch=false --no-progress --code-coverage",
"test:all": "run-p -cs \"test:ci --project lemon-mart\" \"test:ci --project stage8\" \"test:ci --project stage10\" \"test:ci --project stage11\" \"test:ci --project stage12\"",
"test:prod:e2e": "npm run e2e",
"test:coverage": "npm test -- --browsers ChromiumNoSandbox --watch=false --code-coverage",
"posttest:coverage": "http-server -c-1 -o -p 9875 ./coverage",
Expand Down
10 changes: 6 additions & 4 deletions projects/stage11/src/app/user/profile/profile.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@ describe('ProfileComponent', () => {
)

TestBed.configureTestingModule({
providers: commonTestingProviders.concat(
providers: [
...commonTestingProviders,
{
provide: AuthService,
useValue: authServiceSpy,
},
provideNgxMask()
),
provideNgxMask(),
],
imports: [
...commonTestingModules.concat([NgxMaskDirective]),
...commonTestingModules,
NgxMaskDirective,
ProfileComponent,
NameInputComponent,
ViewUserComponent,
Expand Down
3 changes: 2 additions & 1 deletion projects/stage11/src/app/user/profile/profile.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@angular/forms'
import { MatAutocompleteModule } from '@angular/material/autocomplete'
import { MatButtonModule } from '@angular/material/button'
import { MatOptionModule } from '@angular/material/core'
import { MatNativeDateModule, MatOptionModule } from '@angular/material/core'
import { MatDatepickerModule } from '@angular/material/datepicker'
import { MatFormFieldModule } from '@angular/material/form-field'
import { MatIconModule } from '@angular/material/icon'
Expand Down Expand Up @@ -63,6 +63,7 @@ import { IUSState, USStateFilter } from './data'
MatFormFieldModule,
MatInputModule,
MatDatepickerModule,
MatNativeDateModule,
FieldErrorDirective,
MatRadioModule,
LemonRaterComponent,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'
import { ReactiveFormsModule } from '@angular/forms'
import { RouterTestingModule } from '@angular/router/testing'
import { FlexLayoutModule } from '@ngbracket/ngx-layout'

import { AppMaterialModule } from '../../app-material.module'
import { commonTestingModules } from '../../common/common.testing'
import { ViewUserComponent } from './view-user.component'

describe('ViewUserComponent', () => {
Expand All @@ -13,13 +10,7 @@ describe('ViewUserComponent', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
providers: [],
imports: [
ReactiveFormsModule,
FlexLayoutModule,
AppMaterialModule,
RouterTestingModule,
ViewUserComponent,
],
imports: [...commonTestingModules, ViewUserComponent],
}).compileComponents()
}))

Expand Down
17 changes: 13 additions & 4 deletions projects/stage11/src/app/user/view-user/view-user.component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { AsyncPipe, DatePipe, NgIf } from '@angular/common'
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core'
import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'
import { MatButtonModule } from '@angular/material/button'
import { MatCardModule } from '@angular/material/card'
import { MatIconModule } from '@angular/material/icon'
import { Router } from '@angular/router'
import { ActivatedRoute, Router } from '@angular/router'
import { BehaviorSubject } from 'rxjs'

import { IUser, User } from '../user/user'
Expand Down Expand Up @@ -42,15 +42,24 @@ import { IUser, User } from '../user/user'
standalone: true,
imports: [NgIf, MatCardModule, MatIconModule, MatButtonModule, AsyncPipe, DatePipe],
})
export class ViewUserComponent implements OnChanges {
export class ViewUserComponent implements OnInit, OnChanges {
@Input() user!: IUser
readonly currentUser$ = new BehaviorSubject(new User())

get editMode() {
return !this.user
}

constructor(private router: Router) {}
constructor(
private route: ActivatedRoute,
private router: Router
) {}

ngOnInit() {
if (this.route.snapshot.data['user']) {
this.currentUser$.next(this.route.snapshot.data['user'])
}
}

ngOnChanges(changes: SimpleChanges): void {
this.currentUser$.next(User.Build(changes['user'].currentValue))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ describe('UserTableComponent', () => {
TestBed.configureTestingModule({
providers: commonTestingProviders,
imports: [
...commonTestingModules.concat([
FormsModule,

EntityDataModule.forRoot(entityConfig),
EffectsModule.forRoot([]),
StoreModule.forRoot({}),
]),
...commonTestingModules,
FormsModule,
EntityDataModule.forRoot(entityConfig),
EffectsModule.forRoot([]),
StoreModule.forRoot({}),
UserTableComponent,
],
}).compileComponents()
Expand Down
10 changes: 6 additions & 4 deletions projects/stage12/src/app/user/profile/profile.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@ describe('ProfileComponent', () => {
)

TestBed.configureTestingModule({
providers: commonTestingProviders.concat(
providers: [
...commonTestingProviders,
{
provide: AuthService,
useValue: authServiceSpy,
},
provideNgxMask()
),
provideNgxMask(),
],
imports: [
...commonTestingModules.concat([NgxMaskDirective]),
...commonTestingModules,
NgxMaskDirective,
ProfileComponent,
NameInputComponent,
ViewUserComponent,
Expand Down
3 changes: 2 additions & 1 deletion projects/stage12/src/app/user/profile/profile.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@angular/forms'
import { MatAutocompleteModule } from '@angular/material/autocomplete'
import { MatButtonModule } from '@angular/material/button'
import { MatOptionModule } from '@angular/material/core'
import { MatNativeDateModule, MatOptionModule } from '@angular/material/core'
import { MatDatepickerModule } from '@angular/material/datepicker'
import { MatFormFieldModule } from '@angular/material/form-field'
import { MatIconModule } from '@angular/material/icon'
Expand Down Expand Up @@ -64,6 +64,7 @@ import { IUSState, USStateFilter } from './data'
MatFormFieldModule,
MatInputModule,
MatDatepickerModule,
MatNativeDateModule,
FieldErrorDirective,
MatRadioModule,
LemonRaterComponent,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'
import { ReactiveFormsModule } from '@angular/forms'
import { RouterTestingModule } from '@angular/router/testing'
import { FlexLayoutModule } from '@ngbracket/ngx-layout'

import { AppMaterialModule } from '../../app-material.module'
import { commonTestingModules } from '../../common/common.testing'
import { ViewUserComponent } from './view-user.component'

describe('ViewUserComponent', () => {
Expand All @@ -13,13 +10,7 @@ describe('ViewUserComponent', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
providers: [],
imports: [
ReactiveFormsModule,
FlexLayoutModule,
AppMaterialModule,
RouterTestingModule,
ViewUserComponent,
],
imports: [...commonTestingModules, ViewUserComponent],
}).compileComponents()
}))

Expand Down
12 changes: 5 additions & 7 deletions src/app/manager/user-table/user-table.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ describe('UserTableComponent', () => {
TestBed.configureTestingModule({
providers: commonTestingProviders,
imports: [
...commonTestingModules.concat([
FormsModule,

EntityDataModule.forRoot(entityConfig),
EffectsModule.forRoot([]),
StoreModule.forRoot({}),
]),
...commonTestingModules,
FormsModule,
EntityDataModule.forRoot(entityConfig),
EffectsModule.forRoot([]),
StoreModule.forRoot({}),
UserTableComponent,
],
}).compileComponents()
Expand Down
5 changes: 3 additions & 2 deletions src/app/pos/pos/pos.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ describe('PosComponent', () => {

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
providers: commonTestingProviders.concat([
providers: [
...commonTestingProviders,
{ provide: TransactionService, useValue: autoSpyObj(TransactionService) },
]),
],
imports: [...commonTestingModules, PosComponent],
}).compileComponents(),
(transactionServiceMock = injectSpy(TransactionService))
Expand Down
10 changes: 6 additions & 4 deletions src/app/user/profile/profile.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@ describe('ProfileComponent', () => {
)

TestBed.configureTestingModule({
providers: commonTestingProviders.concat(
providers: [
...commonTestingProviders,
{
provide: AuthService,
useValue: authServiceSpy,
},
provideNgxMask()
),
provideNgxMask(),
],
imports: [
...commonTestingModules.concat([NgxMaskDirective]),
...commonTestingModules,
NgxMaskDirective,
ProfileComponent,
NameInputComponent,
ViewUserComponent,
Expand Down

0 comments on commit e1d5a27

Please sign in to comment.