Skip to content

Commit

Permalink
fix jvm-threads.component.spec.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesWt committed Sep 8, 2024
1 parent 83fd408 commit 88e200d
Showing 1 changed file with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,19 @@ describe('JvmThreadsComponent', () => {
let fixture: ComponentFixture<JvmThreadsComponent>;
let modalService: NgbModal;

beforeEach(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ArtemisTestModule, MockComponent(NgbProgressbar)],
declarations: [JvmThreadsComponent],
providers: [{ provide: NgbModal, useClass: MockNgbModalService }],
})
.compileComponents()
.then(() => {
fixture = TestBed.createComponent(JvmThreadsComponent);
comp = fixture.componentInstance;
modalService = TestBed.inject(NgbModal);
});
}).compileComponents();

fixture = TestBed.createComponent(JvmThreadsComponent);
comp = fixture.componentInstance;
modalService = TestBed.inject(NgbModal);
});

it('should store threads and create statistic counts', () => {
it('should store threads and create statistic counts', async () => {
const threads = [
{ threadState: ThreadState.Blocked },
{ threadState: ThreadState.TimedWaiting },
Expand All @@ -39,15 +37,17 @@ describe('JvmThreadsComponent', () => {
{ threadState: ThreadState.Waiting },
] as Thread[];

comp.threads = threads;
fixture.componentRef.setInput('threads', threads);
fixture.detectChanges();
await fixture.whenStable();

expect(comp.threads).toEqual(threads);
expect(comp.threadStats).toEqual({
threadDumpAll: 7,
threadDumpRunnable: 1,
threadDumpTimedWaiting: 2,
threadDumpWaiting: 3,
threadDumpBlocked: 1,
expect(comp.threads()).toEqual(threads);
expect(comp.threadStats()).toEqual({
all: 7,
runnable: 1,
timedWaiting: 2,
waiting: 3,
blocked: 1,
});
});

Expand All @@ -56,7 +56,7 @@ describe('JvmThreadsComponent', () => {
const spy = jest.spyOn(modalService, 'open').mockReturnValue(mockModalRef as NgbModalRef);

const threads = [{ threadState: ThreadState.Blocked }] as Thread[];
comp.threads = threads;
fixture.componentRef.setInput('threads', threads);
fixture.detectChanges();

const button = fixture.debugElement.query(By.css('button.hand.btn.btn-primary.btn-sm'));
Expand Down

0 comments on commit 88e200d

Please sign in to comment.