migrate angular 21 tests

This commit is contained in:
2026-03-09 23:25:11 +01:00
parent bb08e46b0c
commit 0d0873730a
24 changed files with 924 additions and 109 deletions

View File

@@ -1,4 +1,4 @@
import {Injectable, inject} from '@angular/core';
import {EnvironmentInjector, Injectable, inject, runInInjectionContext} from '@angular/core';
import {deleteObject, getDownloadURL, ref, Storage} from '@angular/fire/storage';
import {from, Observable} from 'rxjs';
import {FileDataService} from './file-data.service';
@@ -9,13 +9,14 @@ import {FileDataService} from './file-data.service';
export class FileService {
private storage = inject(Storage);
private fileDataService = inject(FileDataService);
private environmentInjector = inject(EnvironmentInjector);
public getDownloadUrl(path: string): Observable<string> {
return from(getDownloadURL(ref(this.storage, path)));
return from(runInInjectionContext(this.environmentInjector, () => getDownloadURL(ref(this.storage, path))));
}
public delete(path: string, songId: string, fileId: string): void {
void deleteObject(ref(this.storage, path));
void runInInjectionContext(this.environmentInjector, () => deleteObject(ref(this.storage, path)));
void this.fileDataService.delete(songId, fileId);
}
}