title: Jasmine unit test for file size with TypeScript in Angular
body: <p>Searching for best practice how to test File size on input type="file" change event.</p>
  
  <p>Right now my test spec looks like this:</p>
  
  <pre><code>it('attach file with too large size', () =&gt; {
    const file: File = {
      name: 'filename',
      type: 'image/png',
      size: 8242880,
      lastModified: 1,
      lastModifiedDate: new Date(),
      webkitRelativePath: '',
      msClose: () =&gt; {},
      msDetachStream: () =&gt; {},
      slice: (): Blob =&gt; null,
    };
    const event = { target: { files: [file] } };
  
    component.onFileChange(event); // file validation happens into it too
  
    const error = control.getError('file_size');
    expect(error).toBeTruthy();
  });
  </code></pre>
  
  <p>Is there better way how to set File size property with TypeScript?
  When I am trying to setting <code>size</code> property directly to File object, it's not allowed because <code>size</code> property is <code>read-only</code>.</p>
  
  <pre><code>const file = new File([''], 'filename', { type: 'image/png' });
  file.size = 8242880; // TS error
  </code></pre>
  
  <p>Current way how I am mocking File object where I need to define all File object properties for me isn't looking very beautiful, but can't find any better way.
  Any ideas?</p>