Skip to content

Commit

Permalink
test: 💍 make tests green again
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Jun 26, 2020
1 parent 8c2e4e3 commit 06b7743
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,16 @@ describe('"Explore underlying data" panel action', () => {
expect(isCompatible).toBe(false);
});

test('returns false if embeddable is not Visualize embeddable', async () => {
const { action, embeddable, context } = setup();
(embeddable as any).type = 'NOT_VISUALIZE_EMBEDDABLE';
test('returns false if embeddable has more than one index pattern', async () => {
const { action, output, context } = setup();
output.indexPatterns = [
{
id: 'index-ptr-foo',
},
{
id: 'index-ptr-bar',
},
];

const isCompatible = await action.isCompatible(context);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,16 @@ describe('"Explore underlying data" panel action', () => {
expect(isCompatible).toBe(false);
});

test('returns false if embeddable is not Visualize embeddable', async () => {
const { action, embeddable, context } = setup();
(embeddable as any).type = 'NOT_VISUALIZE_EMBEDDABLE';
test('returns false if embeddable has more than one index pattern', async () => {
const { action, output, context } = setup();
output.indexPatterns = [
{
id: 'index-ptr-foo',
},
{
id: 'index-ptr-bar',
},
];

const isCompatible = await action.isCompatible(context);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ export const getIndexPatterns = (embeddable?: IEmbeddable): string[] => {
return isOutputWithIndexPatterns(output) ? output.indexPatterns.map(({ id }) => id) : [];
};

export const hasExactlyOneIndexPattern = (embeddable?: IEmbeddable): string[] =>
export const hasExactlyOneIndexPattern = (embeddable?: IEmbeddable): boolean =>
getIndexPatterns(embeddable).length === 1;

0 comments on commit 06b7743

Please sign in to comment.