You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Writing a unit test for filesystem checking is not trivial. You should NOT create a real file on the system, because then your test will depend on the I/O of the file system itself. The last resort is mocking the filesystem. There are quite a few powerful libraries like spf13/afero for this purpose (mocking of a filesystem). These packages will create temporary files in the background and clean up afterward.
As an exercise, try to write the test first. Let it fail. Then try to fix it, by writing the actual implementation of the function.
NOTICE: If you are unable to mock this test, in worst case scenario, create a folder internal/utils/testdata and put actual files you can use for your test.
The text was updated successfully, but these errors were encountered:
Dev story
Write a function/method that sorts an array in a similar way with the Linux command
sort
Example:
Acceptance Criteria
internal/utils
packageHints:
Extra Help:
NOTICE: If you are unable to mock this test, in worst case scenario, create a folder
internal/utils/testdata
and put actual files you can use for your test.The text was updated successfully, but these errors were encountered: