Skip to content

Commit

Permalink
[Security Solution][Lists] - Tests cleanup and remove unnecessary imp…
Browse files Browse the repository at this point in the history
…ort (elastic#73865)

## Summary

Addresses feedback from elastic#72748

- Updates `plugins/lists` tests text from `should not validate` to `should FAIL validation` after feedback that previous text is a bit confusing and can be interpreted to mean that validation is not conducted
- Remove unnecessary spreads from one of my late night PRs
- Removes `siem_common_deps` in favor of `shared_imports` in `plugins/lists`
- Updates `build_exceptions_query.test.ts` to use existing mocks
  • Loading branch information
yctercero committed Jul 30, 2020
1 parent 025e667 commit 1cf30bb
Show file tree
Hide file tree
Showing 115 changed files with 340 additions and 392 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/lists/common/schemas/common/schemas.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import {
EsDataTypeGeoPoint,
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/lists/common/schemas/common/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import * as t from 'io-ts';

import { DefaultNamespace } from '../types/default_namespace';
import { DefaultStringArray, NonEmptyString } from '../../siem_common_deps';
import { DefaultStringArray, NonEmptyString } from '../../shared_imports';

export const name = t.string;
export type Name = t.TypeOf<typeof name>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { SearchEsListItemSchema, searchEsListItemSchema } from './search_es_list_item_schema';
import { getSearchEsListItemMock } from './search_es_list_item_schema.mock';
Expand All @@ -22,7 +22,7 @@ describe('search_es_list_item_schema', () => {
expect(message.schema).toEqual(payload);
});

test('it should not validate with a madeup value', () => {
test('it should FAIL validation when a madeup value', () => {
const payload: SearchEsListItemSchema & { madeupValue: string } = {
...getSearchEsListItemMock(),
madeupValue: 'madeupvalue',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { SearchEsListSchema, searchEsListSchema } from './search_es_list_schema';
import { getSearchEsListMock } from './search_es_list_schema.mock';
Expand All @@ -22,7 +22,7 @@ describe('search_es_list_schema', () => {
expect(message.schema).toEqual(payload);
});

test('it should not validate with a madeup value', () => {
test('it should FAIL validation when a madeup value', () => {
const payload: SearchEsListSchema & { madeupValue: string } = {
...getSearchEsListMock(),
madeupValue: 'madeupvalue',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';
import { getCreateCommentsArrayMock } from '../types/create_comment.mock';
import { getCommentsMock } from '../types/comment.mock';
import { CommentsArray } from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
import { RequiredKeepUndefined } from '../../types';
import { CreateCommentsArray, DefaultCreateCommentsArray, nonEmptyEntriesArray } from '../types';
import { EntriesArray } from '../types/entries';
import { DefaultUuid } from '../../siem_common_deps';
import { DefaultUuid } from '../../shared_imports';

export const createEndpointListItemSchema = t.intersection([
t.exact(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';
import { getCreateCommentsArrayMock } from '../types/create_comment.mock';
import { getCommentsMock } from '../types/comment.mock';
import { CommentsArray } from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
nonEmptyEntriesArray,
} from '../types';
import { EntriesArray } from '../types/entries';
import { DefaultUuid } from '../../siem_common_deps';
import { DefaultUuid } from '../../shared_imports';

export const createExceptionListItemSchema = t.intersection([
t.exact(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import {
CreateExceptionListSchema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
DefaultUuid,
DefaultVersionNumber,
DefaultVersionNumberDecoded,
} from '../../siem_common_deps';
} from '../../shared_imports';
import { NamespaceType } from '../types';

export const createExceptionListSchema = t.intersection([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { getCreateListItemSchemaMock } from './create_list_item_schema.mock';
import { CreateListItemSchema, createListItemSchema } from './create_list_item_schema';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { CreateListSchema, createListSchema } from './create_list_schema';
import { getCreateListSchemaMock } from './create_list_schema.mock';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as t from 'io-ts';

import { description, deserializer, id, meta, name, serializer, type } from '../common/schemas';
import { RequiredKeepUndefined } from '../../types';
import { DefaultVersionNumber, DefaultVersionNumberDecoded } from '../../siem_common_deps';
import { DefaultVersionNumber, DefaultVersionNumberDecoded } from '../../shared_imports';

export const createListSchema = t.intersection([
t.exact(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import {
DeleteEndpointListItemSchema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import {
DeleteExceptionListItemSchema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import {
DeleteExceptionListSchema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { DeleteListItemSchema, deleteListItemSchema } from './delete_list_item_schema';
import { getDeleteListItemSchemaMock } from './delete_list_item_schema.mock';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { DeleteListSchema, deleteListSchema } from './delete_list_schema';
import { getDeleteListSchemaMock } from './delete_list_schema.mock';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import {
ExportListItemQuerySchema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import {
getFindEndpointListItemSchemaDecodedMock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';
import { LIST_ID } from '../../constants.mock';

import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import {
getFindExceptionListSchemaDecodedMock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';
import { LIST_ID } from '../../constants.mock';

import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { getFindListSchemaDecodedMock, getFindListSchemaMock } from './find_list_schema.mock';
import { FindListSchemaEncoded, findListSchema } from './find_list_schema';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import {
ImportListItemQuerySchema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { ImportListItemSchema, importListItemSchema } from './import_list_item_schema';
import { getImportListItemSchemaMock } from './import_list_item_schema.mock';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { getPathListItemSchemaMock } from './patch_list_item_schema.mock';
import { PatchListItemSchema, patchListItemSchema } from './patch_list_item_schema';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { getPathListSchemaMock } from './patch_list_schema.mock';
import { PatchListSchema, patchListSchema } from './patch_list_schema';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { getReadEndpointListItemSchemaMock } from './read_endpoint_list_item_schema.mock';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { getReadExceptionListItemSchemaMock } from './read_exception_list_item_schema.mock';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { getReadExceptionListSchemaMock } from './read_exception_list_schema.mock';
import { ReadExceptionListSchema, readExceptionListSchema } from './read_exception_list_schema';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { getReadListItemSchemaMock } from './read_list_item_schema.mock';
import { ReadListItemSchema, readListItemSchema } from './read_list_item_schema';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { getReadListSchemaMock } from './read_list_schema.mock';
import { ReadListSchema, readListSchema } from './read_list_schema';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import {
UpdateEndpointListItemSchema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import {
UpdateExceptionListItemSchema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import {
UpdateExceptionListSchema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { UpdateListItemSchema, updateListItemSchema } from './update_list_item_schema';
import { getUpdateListItemSchemaMock } from './update_list_item_schema.mock';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { getAcknowledgeSchemaResponseMock } from './acknowledge_schema.mock';
import { AcknowledgeSchema, acknowledgeSchema } from './acknowledge_schema';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { getExceptionListSchemaMock } from './exception_list_schema.mock';
import { CreateEndpointListSchema, createEndpointListSchema } from './create_endpoint_list_schema';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { getExceptionListItemSchemaMock } from './exception_list_item_schema.mock';
import { ExceptionListItemSchema, exceptionListItemSchema } from './exception_list_item_schema';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { getExceptionListSchemaMock } from './exception_list_schema.mock';
import { ExceptionListSchema, exceptionListSchema } from './exception_list_schema';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { left } from 'fp-ts/lib/Either';
import { pipe } from 'fp-ts/lib/pipeable';

import { exactCheck, foldLeftRight, getPaths } from '../../siem_common_deps';
import { exactCheck, foldLeftRight, getPaths } from '../../shared_imports';

import { getExceptionListItemSchemaMock } from './exception_list_item_schema.mock';
import { getFoundExceptionListItemSchemaMock } from './found_exception_list_item_schema.mock';
Expand Down
Loading

0 comments on commit 1cf30bb

Please sign in to comment.