Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jen-huang committed Mar 16, 2020
1 parent e66fb3b commit d8453ee
Showing 1 changed file with 62 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { isAdvancedVar } from './is_advanced_var';

describe('Ingest Manager - isAdvancedVar', () => {
it('returns true for vars that should be show under advanced options', () => {
expect(
isAdvancedVar({
name: 'mock_var',
type: 'text',
required: true,
default: 'default string',
})
).toBe(true);

expect(
isAdvancedVar({
name: 'mock_var',
type: 'text',
default: 'default string',
})
).toBe(true);

expect(
isAdvancedVar({
name: 'mock_var',
type: 'text',
})
).toBe(true);
});

it('returns false for vars that should be show by default', () => {
expect(
isAdvancedVar({
name: 'mock_var',
type: 'text',
required: true,
default: 'default string',
show_user: true,
})
).toBe(false);

expect(
isAdvancedVar({
name: 'mock_var',
type: 'text',
required: true,
})
).toBe(false);

expect(
isAdvancedVar({
name: 'mock_var',
type: 'text',
show_user: true,
})
).toBe(false);
});
});

0 comments on commit d8453ee

Please sign in to comment.