/** * @file * * Mock of Obsidian's `TFile`, a file in the vault. */ import type { FileStats as FileStatsOriginal, TFile as TFileOriginal } from 'obsidian'; import type { Vault } from './Vault.mjs'; import { TAbstractFile } from './TAbstractFile.mjs'; /** * Mock of Obsidian's `TFile`: a vault file whose basename and extension are derived from its name. */ export declare class TFile extends TAbstractFile { /** * The file name without its extension. */ basename: string; /** * The file extension without the leading dot; empty when the name has no dot. */ extension: string; /** * The file's creation time, modification time and size; all `0` until the vault sets them. */ stat: FileStatsOriginal; /** * Creates a file and splits its name into basename and extension at the last dot. * * @param vault - The vault the file belongs to. * @param path - The file's vault-relative path. */ protected constructor(vault: Vault, path: string); /** * Mock-only factory: creates a file, spyable via `vi.spyOn(TFile, 'create__')`. It does not add the file to the * vault. * * @param vault - The vault the file belongs to. * @param path - The file's vault-relative path. * @returns The new file. */ static create__(vault: Vault, path: string): TFile; /** * Mock-only: views a value typed as Obsidian's `TFile` as this mock. * * @param value - The value typed as the original `TFile`. * @returns The same object, typed as the mock. */ static fromOriginalType2__(value: TFileOriginal): TFile; /** * Mock-only: views this mock as Obsidian's `TFile` type. * * @returns The same object, typed as the original `TFile`. */ asOriginalType2__(): TFileOriginal; /** * Mock-only construction hook, called at the end of the constructor; a no-op meant for * `vi.spyOn(TFile.prototype, 'constructor2__')`. * * @param _vault - The vault the file was created with. * @param _path - The path the file was created with. */ constructor2__(_vault: Vault, _path: string): void; /** * Gets the name Obsidian shows for the file. * * @returns The basename for a markdown file, whose extension the app hides, and the full name for any * other file. */ getShortName(): string; }