Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maps] Updates tests to not rely on field order #62092

Merged
merged 1 commit into from
Apr 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
});
});
}