mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-14 01:21:14 -06:00
Feature: app branding (#5357)
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing'
|
||||
|
||||
import { FileComponent } from './file.component'
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing'
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
|
||||
|
||||
describe('FileComponent', () => {
|
||||
let component: FileComponent
|
||||
let fixture: ComponentFixture<FileComponent>
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [FileComponent],
|
||||
imports: [FormsModule, ReactiveFormsModule, HttpClientTestingModule],
|
||||
}).compileComponents()
|
||||
|
||||
fixture = TestBed.createComponent(FileComponent)
|
||||
component = fixture.componentInstance
|
||||
fixture.detectChanges()
|
||||
})
|
||||
|
||||
it('should update file on change', () => {
|
||||
const event = { target: { files: [new File([], 'test.png')] } }
|
||||
component.onFile(event as any)
|
||||
expect(component.file.name).toEqual('test.png')
|
||||
})
|
||||
|
||||
it('should get filename', () => {
|
||||
component.value = 'https://example.com:8000/logo/filename.svg'
|
||||
expect(component.filename).toEqual('filename.svg')
|
||||
})
|
||||
|
||||
it('should fire upload event', () => {
|
||||
let firedFile
|
||||
component.file = new File([], 'test.png')
|
||||
component.upload.subscribe((file) => (firedFile = file))
|
||||
component.uploadClicked()
|
||||
expect(firedFile.name).toEqual('test.png')
|
||||
expect(component.file).toBeUndefined()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user