All files / src/fsa-to-node FsaNodeStats.ts

83.87% Statements 26/31
50% Branches 2/4
37.5% Functions 3/8
83.87% Lines 26/31

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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81    2x 2x 2x   2x                                             977x   977x 977x 977x 977x 977x 977x 977x 977x 977x 977x 977x 977x 977x 977x 977x 977x 977x 977x 977x       690x       236x                                              
import type * as misc from '../node/types/misc';
 
const time: number = 0;
const timex: bigint = typeof BigInt === 'function' ? BigInt(time) : (time as any as bigint);
const date = new Date(time);
 
export class FsaNodeStats<T = misc.TStatNumber> implements misc.IStats<T> {
  public readonly uid: T;
  public readonly gid: T;
  public readonly rdev: T;
  public readonly blksize: T;
  public readonly ino: T;
  public readonly size: T;
  public readonly blocks: T;
  public readonly atime: Date;
  public readonly mtime: Date;
  public readonly ctime: Date;
  public readonly birthtime: Date;
  public readonly atimeMs: T;
  public readonly mtimeMs: T;
  public readonly ctimeMs: T;
  public readonly birthtimeMs: T;
  public readonly dev: T;
  public readonly mode: T;
  public readonly nlink: T;
 
  public constructor(
    isBigInt: boolean,
    size: T,
    protected readonly kind: 'file' | 'directory',
  ) {
    const dummy = (isBigInt ? timex : time) as any as T;
    this.uid = dummy;
    this.gid = dummy;
    this.rdev = dummy;
    this.blksize = dummy;
    this.ino = dummy;
    this.size = size;
    this.blocks = dummy;
    this.atime = date;
    this.mtime = date;
    this.ctime = date;
    this.birthtime = date;
    this.atimeMs = dummy;
    this.mtimeMs = dummy;
    this.ctimeMs = dummy;
    this.birthtimeMs = dummy;
    this.dev = dummy;
    this.mode = dummy;
    this.nlink = dummy;
  }
 
  public isDirectory(): boolean {
    return this.kind === 'directory';
  }
 
  public isFile(): boolean {
    return this.kind === 'file';
  }
 
  public isBlockDevice(): boolean {
    return false;
  }
 
  public isCharacterDevice(): boolean {
    return false;
  }
 
  public isSymbolicLink(): boolean {
    return false;
  }
 
  public isFIFO(): boolean {
    return false;
  }
 
  public isSocket(): boolean {
    return false;
  }
}