harbor/src/portal/src/app/shared/components/label-selector/label-selector.component.sp...

65 lines
2.1 KiB
TypeScript
Raw Normal View History

import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LabelSelectorComponent } from './label-selector.component';
import { SharedTestingModule } from '../../shared.module';
import { LabelService } from '../../../../../ng-swagger-gen/services/label.service';
import { Label } from '../../../../../ng-swagger-gen/models/label';
import { of } from 'rxjs';
import { delay, finalize } from 'rxjs/operators';
describe('LabelSelectorComponent', () => {
let component: LabelSelectorComponent;
let fixture: ComponentFixture<LabelSelectorComponent>;
const mockedLabels: Label[] = [
{
id: 1,
name: 'good',
scope: 'p',
project_id: 1,
color: '#ccc',
},
{
id: 2,
name: 'bad',
scope: 'p',
project_id: 1,
color: '#ccc',
},
];
let spy: jasmine.Spy;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [SharedTestingModule],
declarations: [LabelSelectorComponent],
}).compileComponents();
fixture = TestBed.createComponent(LabelSelectorComponent);
component = fixture.componentInstance;
spy = spyOn(TestBed.inject(LabelService), 'ListLabels').and.returnValue(
of(mockedLabels).pipe(delay(0))
);
fixture.detectChanges();
await fixture.whenStable();
component.loading = false;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should render candidates', async () => {
await fixture.whenStable();
const rows = fixture.nativeElement.querySelectorAll('hbr-label-piece');
expect(rows.length).toEqual(2);
});
it('owned labels should be checked', async () => {
await fixture.whenStable();
component.ownedLabels = [mockedLabels[0]];
fixture.detectChanges();
await fixture.whenStable();
const checkIcon = fixture.nativeElement.querySelector('.check-icon');
Upgrade to distribution (registry) v3 alpha (#19784) * registryctl/api/registry/blob: fix dropped test error (#19721) Signed-off-by: Lars Lehtonen <lars.lehtonen@gmail.com> * Remove robot account update quota permission (#19819) Signed-off-by: Yang Jiao <yang.jiao@broadcom.com> Co-authored-by: Yang Jiao <yang.jiao@broadcom.com> * Cache image list with digest key (#19801) fixes #19429 Signed-off-by: stonezdj <daojunz@vmware.com> Co-authored-by: stonezdj <daojunz@vmware.com> * Add quota permissions testcase (#19822) Signed-off-by: Yang Jiao <yang.jiao@broadcom.com> Co-authored-by: Yang Jiao <yang.jiao@broadcom.com> * deprecate gosec in makefile (#19828) remove the unused the part from makefile Signed-off-by: wang yan <wangyan@vmware.com> * Add verification that robot account duration is not 0 (#19829) Signed-off-by: Yang Jiao <yang.jiao@broadcom.com> * fix artifact page bug (#19807) * fix artifact page bug * update testcase * Upgrade to distribution (registry) v3 alpha This includes all the benefits of the v3 distribution, but also all breaking changes. Most notably, Image Manifest v2 Schema v1 support has been dropped, as well as the `oss` and `swift` storage drivers. Currently, this still relies on v2's github.com/docker/distribution/registry/client/auth/challenge, because that code has been removed from the public API in v3. Signed-off-by: Aaron Dewes <aaron.dewes@protonmail.com> --------- Signed-off-by: Lars Lehtonen <lars.lehtonen@gmail.com> Signed-off-by: Yang Jiao <yang.jiao@broadcom.com> Signed-off-by: stonezdj <daojunz@vmware.com> Signed-off-by: wang yan <wangyan@vmware.com> Signed-off-by: Aaron Dewes <aaron.dewes@protonmail.com> Co-authored-by: Lars Lehtonen <lars.lehtonen@gmail.com> Co-authored-by: Yang Jiao <72076317+YangJiao0817@users.noreply.github.com> Co-authored-by: Yang Jiao <yang.jiao@broadcom.com> Co-authored-by: stonezdj(Daojun Zhang) <stonezdj@gmail.com> Co-authored-by: stonezdj <daojunz@vmware.com> Co-authored-by: Wang Yan <wangyan@vmware.com> Co-authored-by: ShengqiWang <124650040+ShengqiWang@users.noreply.github.com>
2024-01-26 22:48:06 +01:00
expect(checkIcon.style.visibility).toEqual('hidden');
});
});