Skip to content

Instantly share code, notes, and snippets.

@kozo002
Created May 27, 2020 03:31
Show Gist options
  • Save kozo002/99beb2569359326f66a69327e141f8cc to your computer and use it in GitHub Desktop.
Save kozo002/99beb2569359326f66a69327e141f8cc to your computer and use it in GitHub Desktop.
function validateImageSize(file: File): boolean {
return file.size < 10000
}
describe('when the file size is exceeded the limitation', () => {
it('returns false', () => {
const dummyFile = new File([''], 'example.jpg')
dummyFile.size = 10001
expect(validateImageSize(dummyFile)).toBe(false)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment