Created
May 23, 2023 19:53
-
-
Save theusindabike/39e334feecef0c009faea2ce207ab133 to your computer and use it in GitHub Desktop.
using mock-fs to create a text file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('throws error if class-validator return error', async () => { | |
mockfs({ | |
'test_dir/assets': { | |
'sales_sample.txt': mockfs.file({ | |
content: | |
'2022-01-15T19:20:30-03:00CURSO DE BEM-ESTAR 0000012750JOSE CARLOS\n12021-12-03T11:46:02-03:00DOMINANDO INVESTIMENTOS 0000050000MARIA CANDIDA', | |
}), | |
}, | |
}); | |
const file = fs.readFileSync('test_dir/assets/sales_sample.txt'); | |
mockfs.restore(); | |
expect( | |
service.importTransactions({ buffer: file } as Express.Multer.File), | |
). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment