diff --git a/dashboards-reports/server/routes/utils/__tests__/savedSearchReportHelper.test.ts b/dashboards-reports/server/routes/utils/__tests__/savedSearchReportHelper.test.ts index 4b74e97e..332c6f53 100644 --- a/dashboards-reports/server/routes/utils/__tests__/savedSearchReportHelper.test.ts +++ b/dashboards-reports/server/routes/utils/__tests__/savedSearchReportHelper.test.ts @@ -289,6 +289,20 @@ describe('test create saved search report', () => { }, 20000); }); +test('create report for data set contains null field value', async () => { + const hits = [ + hit({ category: 'c1', customer_gender: 'Ma' }), + hit({ category: 'c2', customer_gender: 'le' }), + hit({ category: 'c3', customer_gender: null }), + ]; + const client = mockEsClient(hits); + const { dataUrl } = await createSavedSearchReport(input, client); + + expect(dataUrl).toEqual( + 'category,customer_gender\n' + 'c1,Ma\n' + 'c2,le\n' + 'c3, ' + ); +}, 20000); + /** * Mock Elasticsearch client and return different mock objects based on endpoint and parameters. */