From 2c8c69d253ba30c418b1b4edbd8f0a655d78e844 Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Tue, 31 Mar 2020 17:02:19 -0700 Subject: [PATCH] [Maps] Updates tests to not rely on field order Elasticsearch master is now returning a different order for these fields and is failing the promotion of our nightly builds. Signed-off-by: Tyler Smalley --- .../apps/maps/documents_source/docvalue_fields.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/x-pack/test/functional/apps/maps/documents_source/docvalue_fields.js b/x-pack/test/functional/apps/maps/documents_source/docvalue_fields.js index fdacd89722d3c..a313508e5d06e 100644 --- a/x-pack/test/functional/apps/maps/documents_source/docvalue_fields.js +++ b/x-pack/test/functional/apps/maps/documents_source/docvalue_fields.js @@ -29,26 +29,26 @@ export default function({ getPageObjects, getService }) { await PageObjects.maps.loadSavedMap('document example'); const response = await getResponse(); const firstHit = response.hits.hits[0]; - expect(Object.keys(firstHit).join(',')).to.equal('_index,_id,_score,fields'); - expect(Object.keys(firstHit.fields).join(',')).to.equal('geo.coordinates'); + expect(firstHit).to.only.have.keys(['_id', '_index', '_score', 'fields']); + expect(firstHit.fields).to.only.have.keys(['geo.coordinates']); }); it('should only fetch geo_point field and data driven styling fields', async () => { await PageObjects.maps.loadSavedMap('document example with data driven styles'); const response = await getResponse(); const firstHit = response.hits.hits[0]; - expect(Object.keys(firstHit).join(',')).to.equal('_index,_id,_score,fields'); - expect(Object.keys(firstHit.fields).join(',')).to.equal('geo.coordinates,bytes,hour_of_day'); + expect(firstHit).to.only.have.keys(['_id', '_index', '_score', 'fields']); + expect(firstHit.fields).to.only.have.keys(['bytes', 'geo.coordinates', 'hour_of_day']); }); it('should format date fields as epoch_millis when data driven styling is applied to a date field', async () => { await PageObjects.maps.loadSavedMap('document example with data driven styles on date field'); const response = await getResponse(); const firstHit = response.hits.hits[0]; - expect(Object.keys(firstHit).join(',')).to.equal('_index,_id,_score,fields'); - expect(Object.keys(firstHit.fields).join(',')).to.equal('geo.coordinates,bytes,@timestamp'); + expect(firstHit).to.only.have.keys(['_id', '_index', '_score', 'fields']); + expect(firstHit.fields).to.only.have.keys(['@timestamp', 'bytes', 'geo.coordinates']); expect(firstHit.fields['@timestamp']).to.be.an('array'); - expect(firstHit.fields['@timestamp'][0]).to.equal('1442709321445'); + expect(firstHit.fields['@timestamp'][0]).to.eql('1442709321445'); }); }); }