Skip to content

Commit

Permalink
Merge branch 'master' into prepare-release-1.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
albertteoh authored Feb 22, 2021
2 parents c88ef0f + dac6913 commit de71c65
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"**/fstream": "1.0.12",
"**/handlebars": "4.1.2",
"**/js-yaml": "3.13.1",
"**/lodash": "4.17.19",
"**/lodash": "4.17.21",
"**/node-gyp/tar": "2.2.2",
"**/prettier": "1.18.2"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ export function mapStateToProps(state) {
};
}

function mapDispatchToProps(dispatch) {
export function mapDispatchToProps(dispatch) {
const { searchTraces } = bindActionCreators(jaegerApiActions, dispatch);
return {
onSubmit: fields => submitForm(fields, searchTraces),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
convTagsLogfmt,
getUnixTimeStampInMSFromForm,
lookbackToTimestamp,
mapDispatchToProps,
mapStateToProps,
optionsWithinMaxLookback,
submitForm,
Expand Down Expand Up @@ -264,6 +265,23 @@ describe('submitForm()', () => {
expect(operation).toBe(undefined);
});

it('expects operation to be value defined in beforeEach', () => {
submitForm(fields, searchTraces);
const { calls } = searchTraces.mock;
expect(calls.length).toBe(1);
const { operation } = calls[0][0];
expect(operation).toBe('op-a');
});

it('expects operation to be value assigned before call is made', () => {
fields.operation = 'test';
submitForm(fields, searchTraces);
const { calls } = searchTraces.mock;
expect(calls.length).toBe(1);
const { operation } = calls[0][0];
expect(operation).toBe('test');
});

describe('`fields.lookback`', () => {
function getCalledDuration(mock) {
const { start, end } = mock.calls[0][0];
Expand Down Expand Up @@ -370,6 +388,22 @@ describe('<SearchForm>', () => {
expect(ops.prop('props').disabled).toBe(false);
});

it('keeps operation disabled when no service selected', () => {
let ops = wrapper.find('[placeholder="Select An Operation"]');
expect(ops.prop('props').disabled).toBe(true);
wrapper = shallow(<SearchForm {...defaultProps} selectedService="" />);
ops = wrapper.find('[placeholder="Select An Operation"]');
expect(ops.prop('props').disabled).toBe(true);
});

it('enables operation when unknown service selected', () => {
let ops = wrapper.find('[placeholder="Select An Operation"]');
expect(ops.prop('props').disabled).toBe(true);
wrapper = shallow(<SearchForm {...defaultProps} selectedService="svcC" />);
ops = wrapper.find('[placeholder="Select An Operation"]');
expect(ops.prop('props').disabled).toBe(false);
});

it('shows custom date inputs when `props.selectedLookback` is "custom"', () => {
function getDateFieldLengths(compWrapper) {
return [
Expand Down Expand Up @@ -439,7 +473,7 @@ describe('mapStateToProps()', () => {
let state;

beforeEach(() => {
state = { router: { location: { serach: '' } } };
state = { router: { location: { search: '' } } };
});

it('does not explode when the query string is empty', () => {
Expand Down Expand Up @@ -542,3 +576,11 @@ describe('mapStateToProps()', () => {
expect(msDiff(dateParams.dateStr, dateParams.dateTimeStr, endDate, endDateTime)).toBeLessThan(60 * 1000);
});
});

describe('mapDispatchToProps()', () => {
it('creates the actions correctly', () => {
expect(mapDispatchToProps(() => {})).toEqual({
onSubmit: expect.any(Function),
});
});
});
13 changes: 7 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1683,8 +1683,9 @@
"@types/react" "*"

"@types/react-virtualized-select@^3.0.7":
version "3.0.7"
resolved "https://registry.yarnpkg.com/@types/react-virtualized-select/-/react-virtualized-select-3.0.7.tgz#068c97c5ff1cd46b292b29a34cb06f2efa0e94d4"
version "3.0.8"
resolved "https://registry.yarnpkg.com/@types/react-virtualized-select/-/react-virtualized-select-3.0.8.tgz#0f138e64654e45f438592d1bae5a18cf10f017c8"
integrity sha512-2cZiWj0k3cdW7JkEfJbPiHJSurjej91FCHvh9vt76wVYnSoOcs4RIImoLO1YHegxwbNP1GD7CbFtcgUp+wNvZw==
dependencies:
"@types/react" "*"
"@types/react-select" "^1"
Expand Down Expand Up @@ -7969,10 +7970,10 @@ lodash.uniq@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"

[email protected].19, [email protected], "lodash@>=3.5 <5", lodash@^3.10.0, lodash@^4.15.0, lodash@^4.16.5, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1:
version "4.17.19"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==
[email protected].21, [email protected], "lodash@>=3.5 <5", lodash@^3.10.0, lodash@^4.15.0, lodash@^4.16.5, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==

logfmt@^1.2.0:
version "1.2.1"
Expand Down

0 comments on commit de71c65

Please sign in to comment.