-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged in feature/SHIBUI-1528 (pull request #400)
SHIBUI-1528 Updated code w/ tests
- Loading branch information
Showing
43 changed files
with
939 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
ui/src/app/admin/component/access-request.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { Component, ViewChild } from '@angular/core'; | ||
import { TestBed, async, ComponentFixture } from '@angular/core/testing'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
import { NgbDropdownModule, NgbModal } from '@ng-bootstrap/ng-bootstrap'; | ||
import { Store, StoreModule, combineReducers } from '@ngrx/store'; | ||
import { FormsModule } from '@angular/forms'; | ||
|
||
import { NgbModalStub } from '../../../testing/modal.stub'; | ||
import { AccessRequestComponent } from './access-request.component'; | ||
import * as fromAdmin from '../reducer'; | ||
import * as fromCore from '../../core/reducer'; | ||
|
||
@Component({ | ||
template: ` | ||
<access-request-component></access-request-component> | ||
` | ||
}) | ||
class TestHostComponent { | ||
@ViewChild(AccessRequestComponent, { static: true }) | ||
public componentUnderTest: AccessRequestComponent; | ||
} | ||
|
||
describe('Access Request Component', () => { | ||
|
||
let app: AccessRequestComponent; | ||
let fixture: ComponentFixture<TestHostComponent>; | ||
let instance: TestHostComponent; | ||
let store: Store<fromAdmin.State>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
FormsModule, | ||
NgbDropdownModule, | ||
RouterTestingModule, | ||
StoreModule.forRoot({ | ||
admin: combineReducers(fromAdmin.reducers), | ||
core: combineReducers(fromCore.reducers) | ||
}) | ||
], | ||
declarations: [ | ||
AccessRequestComponent, | ||
TestHostComponent | ||
], | ||
providers: [ | ||
{ | ||
provide: NgbModal, | ||
useClass: NgbModalStub | ||
} | ||
] | ||
}).compileComponents(); | ||
|
||
store = TestBed.get(Store); | ||
spyOn(store, 'dispatch'); | ||
|
||
fixture = TestBed.createComponent(TestHostComponent); | ||
instance = fixture.componentInstance; | ||
app = instance.componentUnderTest; | ||
fixture.detectChanges(); | ||
})); | ||
|
||
it('should compile without error', async(() => { | ||
expect(app).toBeTruthy(); | ||
})); | ||
}); |
55 changes: 55 additions & 0 deletions
55
ui/src/app/admin/component/delete-user-dialog.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { Component, ViewChild } from '@angular/core'; | ||
import { TestBed, async, ComponentFixture } from '@angular/core/testing'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
|
||
import { NgbDropdownModule, NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; | ||
|
||
import { DeleteUserDialogComponent } from './delete-user-dialog.component'; | ||
|
||
@Component({ | ||
template: ` | ||
<delete-user-dialog></delete-user-dialog> | ||
` | ||
}) | ||
class TestHostComponent { | ||
@ViewChild(DeleteUserDialogComponent, { static: true }) | ||
public componentUnderTest: DeleteUserDialogComponent; | ||
} | ||
|
||
describe('Delete Dialog (modal) Component', () => { | ||
|
||
let app: DeleteUserDialogComponent; | ||
let fixture: ComponentFixture<TestHostComponent>; | ||
let instance: TestHostComponent; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
NgbDropdownModule, | ||
RouterTestingModule | ||
], | ||
declarations: [ | ||
DeleteUserDialogComponent, | ||
TestHostComponent | ||
], | ||
providers: [ | ||
{ | ||
provide: NgbActiveModal, | ||
useValue: jasmine.createSpyObj('activeModal', [ | ||
'close', | ||
'dismiss' | ||
]) | ||
} | ||
] | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(TestHostComponent); | ||
instance = fixture.componentInstance; | ||
app = instance.componentUnderTest; | ||
fixture.detectChanges(); | ||
})); | ||
|
||
it('should compile without error', async(() => { | ||
expect(app).toBeTruthy(); | ||
})); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
ui/src/app/admin/component/enable-metadata.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { Component, ViewChild } from '@angular/core'; | ||
import { TestBed, async, ComponentFixture } from '@angular/core/testing'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
|
||
import { NgbDropdownModule, NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap'; | ||
|
||
import { EnableMetadataComponent } from './enable-metadata.component'; | ||
|
||
import * as fromAdmin from '../reducer'; | ||
import { Store, StoreModule, combineReducers } from '@ngrx/store'; | ||
import { NgbModalStub } from '../../../testing/modal.stub'; | ||
import { MockResolversListComponent } from '../../../testing/resolvers-list.component.stub'; | ||
|
||
@Component({ | ||
template: ` | ||
<enable-metadata></enable-metadata> | ||
` | ||
}) | ||
class TestHostComponent { | ||
@ViewChild(EnableMetadataComponent, { static: true }) | ||
public componentUnderTest: EnableMetadataComponent; | ||
} | ||
|
||
describe('Enable Metadata (modal) Component', () => { | ||
|
||
let app: EnableMetadataComponent; | ||
let fixture: ComponentFixture<TestHostComponent>; | ||
let instance: TestHostComponent; | ||
let store: Store<fromAdmin.State>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
NgbDropdownModule, | ||
RouterTestingModule, | ||
StoreModule.forRoot({ | ||
admin: combineReducers(fromAdmin.reducers) | ||
}) | ||
], | ||
declarations: [ | ||
EnableMetadataComponent, | ||
TestHostComponent, | ||
MockResolversListComponent | ||
], | ||
providers: [ | ||
{ | ||
provide: NgbModal, | ||
useClass: NgbModalStub | ||
} | ||
] | ||
}).compileComponents(); | ||
|
||
store = TestBed.get(Store); | ||
spyOn(store, 'dispatch'); | ||
|
||
fixture = TestBed.createComponent(TestHostComponent); | ||
instance = fixture.componentInstance; | ||
app = instance.componentUnderTest; | ||
fixture.detectChanges(); | ||
})); | ||
|
||
it('should compile without error', async(() => { | ||
expect(app).toBeTruthy(); | ||
})); | ||
}); |
64 changes: 64 additions & 0 deletions
64
ui/src/app/admin/component/user-management.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { Component, ViewChild } from '@angular/core'; | ||
import { TestBed, async, ComponentFixture } from '@angular/core/testing'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
import { Store, StoreModule, combineReducers } from '@ngrx/store'; | ||
import { NgbDropdownModule, NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { UserManagementComponent } from './user-management.component'; | ||
import { NgbModalStub } from '../../../testing/modal.stub'; | ||
import * as fromAdmin from '../reducer'; | ||
import * as fromCore from '../../core/reducer'; | ||
|
||
@Component({ | ||
template: ` | ||
<user-management></user-management> | ||
` | ||
}) | ||
class TestHostComponent { | ||
@ViewChild(UserManagementComponent, { static: true }) | ||
public componentUnderTest: UserManagementComponent; | ||
} | ||
|
||
describe('User Management Component', () => { | ||
|
||
let app: UserManagementComponent; | ||
let fixture: ComponentFixture<TestHostComponent>; | ||
let instance: TestHostComponent; | ||
let store: Store<fromAdmin.State>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
FormsModule, | ||
NgbDropdownModule, | ||
RouterTestingModule, | ||
StoreModule.forRoot({ | ||
admin: combineReducers(fromAdmin.reducers), | ||
core: combineReducers(fromCore.reducers) | ||
}) | ||
], | ||
declarations: [ | ||
UserManagementComponent, | ||
TestHostComponent | ||
], | ||
providers: [ | ||
{ | ||
provide: NgbModal, | ||
useClass: NgbModalStub | ||
} | ||
] | ||
}).compileComponents(); | ||
|
||
store = TestBed.get(Store); | ||
spyOn(store, 'dispatch'); | ||
|
||
fixture = TestBed.createComponent(TestHostComponent); | ||
instance = fixture.componentInstance; | ||
app = instance.componentUnderTest; | ||
fixture.detectChanges(); | ||
})); | ||
|
||
it('should compile without error', async(() => { | ||
expect(app).toBeTruthy(); | ||
})); | ||
}); |
Oops, something went wrong.