All files / libs/vendors/google-cloud/cloud-storage/src/lib/builders file-path.builder.ts

100% Statements 27/27
100% Branches 5/5
100% Functions 5/5
100% Lines 27/27

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 281x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x 1x 1x 3x 3x 3x 1x 1x 3x 3x 3x 1x 1x 3x 3x 1x  
import { type Company } from '@amalia/core/models';
 
export class FilePathBuilder {
  private folder?: string;
 
  private fileName?: string;
 
  private constructor(private readonly company: Pick<Company, 'id'>) {}
 
  public static forCompany(company: Pick<Company, 'id'>): FilePathBuilder {
    return new FilePathBuilder(company);
  }
 
  public withFolder(folder: string): this {
    this.folder = folder;
    return this;
  }
 
  public withFileName(fileName: string): this {
    this.fileName = fileName;
    return this;
  }
 
  public build(): string {
    return [this.company.id, this.folder, this.fileName].filter(Boolean).join('/');
  }
}