README
Serializer for XLSX Workbooks
Turn an xlsx-populate workbook into a pretty snapshot.
The serializer will also look for columns marked as ID or Date and mask them, as these will normally change from test to test.
Usage
First you need to add the snapshot serializer. You have two options:
- Expect.addSerializer
const xlsxPopulateSerializer = require('jest-serializer-xlsx-populate');
expect.addSnapshotSerializer(xslxPopulateSerializer);
- Jest config
for example in package.json
{
"name": "my project",
"jest": {
"snapshotSerializers": ["jest-serializer-xlsx-populate"]
}
}
Then you can serialize
const wb = await XlsxPopulate.fromFileAsync('my-file.xlsx');
expect(wb).toMatchSnapshot();
Of course since you're using xlsx populate to create an xlsx file, it will probably be easier to test the Workbook before saving to disk.