Skip to content
Snippets Groups Projects
Commit 555688a1 authored by OZGCloud's avatar OZGCloud
Browse files

remove unused/deprecated component

parent a06e6d06
Branches
Tags
No related merge requests found
export * from './lib/binary-file-upload-container/binary-file-upload-container.component';
export * from './lib/binary-file.module'; export * from './lib/binary-file.module';
<goofy-client-spinner [stateResource]="uploadInProgress$ | async">
<goofy-client-file-upload (fileChanged)="uploadFile($event)"></goofy-client-file-upload>
</goofy-client-spinner>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { BinaryFileService } from '@goofy-client/binary-file-shared';
import { createEmptyStateResource, createStateResource } from '@goofy-client/tech-shared';
import { mock } from '@goofy-client/test-utils';
import { FileUploadComponent, SpinnerComponent } from '@goofy-client/ui';
import { createCommandResource } from 'libs/command-shared/test/command';
import { configureTestSuite } from 'ng-bullet';
import { MockComponent } from 'ng-mocks';
import { of } from 'rxjs';
import { BinaryFileUploadContainerComponent } from './binary-file-upload-container.component';
describe('BinaryFileUploadContainerComponent', () => {
let component: BinaryFileUploadContainerComponent;
let fixture: ComponentFixture<BinaryFileUploadContainerComponent>;
const service = mock(BinaryFileService);
configureTestSuite(() => {
TestBed.configureTestingModule({
declarations: [
BinaryFileUploadContainerComponent,
MockComponent(FileUploadComponent),
MockComponent(SpinnerComponent)
],
providers: [
{
provide: BinaryFileService,
useValue: service
}
]
})
})
beforeEach(() => {
fixture = TestBed.createComponent(BinaryFileUploadContainerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
describe.skip('uploadFile', () => {
const file: any = {};
beforeEach(() => {
service.uploadFile.mockReturnValue(of(file));
})
it('should call service', () => {
component.uploadFile(file)
expect(service.uploadFile).toBeCalledWith(file);
})
})
describe('emit', () => {
beforeEach(() => {
spyOn(component.uploadFinish, 'emit');
fixture.detectChanges();
})
it('should emit on loaded resource', () => {
component.emit(createStateResource(createCommandResource()));
expect(component.uploadFinish.emit).toHaveBeenCalled();
})
it('should not emit on pending resource', () => {
component.emit(createEmptyStateResource());
expect(component.uploadFinish.emit).not.toHaveBeenCalled();
})
})
});
import { Component, EventEmitter, Output } from '@angular/core';
import { BinaryFileService } from '@goofy-client/binary-file-shared';
import { CommandResource } from '@goofy-client/command-shared';
import { createEmptyStateResource, StateResource } from '@goofy-client/tech-shared';
import { Observable, of } from 'rxjs';
@Component({
selector: 'goofy-client-binary-file-upload-container',
templateUrl: './binary-file-upload-container.component.html',
styleUrls: ['./binary-file-upload-container.component.scss']
})
export class BinaryFileUploadContainerComponent {
uploadInProgress$: Observable<StateResource<CommandResource>> = of(createEmptyStateResource());
@Output() uploadFinish: EventEmitter<File> = new EventEmitter();
constructor(private service: BinaryFileService) { }
uploadFile(file: File): void {
//this.uploadInProgress$ = this.service.uploadFile(file).pipe(tap(stateResource => this.emit(stateResource)));
}
emit(stateResource: StateResource<any>): void {
if (stateResource.loaded) this.uploadFinish.emit(stateResource.resource);
}
}
\ No newline at end of file
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { BinaryFileSharedModule } from '@goofy-client/binary-file-shared';
import { UiModule } from '@goofy-client/ui';
import { BinaryFileUploadContainerComponent } from './binary-file-upload-container/binary-file-upload-container.component';
@NgModule({ @NgModule({
imports: [ imports: [CommonModule]
CommonModule,
BinaryFileSharedModule,
UiModule
],
declarations: [
BinaryFileUploadContainerComponent
],
exports: [BinaryFileUploadContainerComponent]
}) })
export class BinaryFileModule { } export class BinaryFileModule { }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment