-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixing bug and adding make_nested_label tests
- Loading branch information
Showing
4 changed files
with
44 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/ui/public/agg_types/__tests__/metrics/lib/make_nested_label.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import expect from 'expect.js'; | ||
import makeNestedLabel from 'ui/agg_types/metrics/lib/make_nested_label'; | ||
|
||
describe('metric agg make_nested_label', function () { | ||
|
||
function generateAggConfig(metricLabel) { | ||
return { | ||
params: { | ||
customMetric: { | ||
makeLabel: () => { return metricLabel; } | ||
} | ||
} | ||
}; | ||
} | ||
|
||
it('should return a metric label with prefix', function () { | ||
const aggConfig = generateAggConfig('Count'); | ||
const label = makeNestedLabel(aggConfig, 'derivative of'); | ||
expect(label).to.eql('Derivative of Count'); | ||
}); | ||
|
||
it('should return a numbered prefix', function () { | ||
const aggConfig = generateAggConfig('Derivative of Count'); | ||
const label = makeNestedLabel(aggConfig, 'derivative of'); | ||
expect(label).to.eql('2. derivative of Count'); | ||
}); | ||
|
||
it('should return a prefix with correct order', function () { | ||
const aggConfig = generateAggConfig('3. derivative of Count'); | ||
const label = makeNestedLabel(aggConfig, 'derivative of'); | ||
expect(label).to.eql('4. derivative of Count'); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
src/ui/public/agg_types/metrics/lib/parent_pipeline_agg_writter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters