Skip to content

Commit

Permalink
[Maps] Updates tests to not rely on field order
Browse files Browse the repository at this point in the history
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 <tyler.smalley@elastic.co>
  • Loading branch information
Tyler Smalley committed Apr 1, 2020
1 parent 93ad6d4 commit 2c8c69d
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
}

0 comments on commit 2c8c69d

Please sign in to comment.