I'm trying to write a test with jasmine for a typescript method that reads a file and processes it. This method has two steps (outside of reading the file): validating the file and then processing it. I want to test that the method throws an exception when the file is invalid.
For my tests, I need example files to test, so I was wondering what the best practice to generate/store representative test files is. Should I create these by hand and save them with the tests? Should I write something that generates files to test? Write something that generates file data to test? Something else entirely?
From other questions (Unit Testing File I/O) I can see that I don't need to test the I/O itself, just the method's functionality, but I do need some data to test the method with.