[Security Solution][Lists] - Tests cleanup and remove unnecessary import (#73865)

## Summary

Addresses feedback from https://github.com/elastic/kibana/pull/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
This commit is contained in:
Yara Tercero 2020-07-30 19:16:51 -04:00 committed by GitHub
parent 9c9080c11e
commit 84884a9398
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
115 changed files with 340 additions and 392 deletions

View file

@ -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,

View file

@ -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>;

View file

@ -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';
@ -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',

View file

@ -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';
@ -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',

View file

@ -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';

View file

@ -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(

View file

@ -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';

View file

@ -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(

View file

@ -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,

View file

@ -25,7 +25,7 @@ import {
DefaultUuid,
DefaultVersionNumber,
DefaultVersionNumberDecoded,
} from '../../siem_common_deps';
} from '../../shared_imports';
import { NamespaceType } from '../types';
export const createExceptionListSchema = t.intersection([

View file

@ -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';

View file

@ -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';

View file

@ -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(

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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';

View file

@ -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';

View file

@ -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,

View file

@ -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,

View file

@ -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 {

View file

@ -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,

View file

@ -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 {

View file

@ -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';

View file

@ -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,

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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 {

View file

@ -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 {

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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 { getFoundExceptionListSchemaMock } from './found_exception_list_schema.mock';

View file

@ -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 { getListItemIndexExistSchemaResponseMock } from './list_item_index_exist_schema.mock';
import { ListItemIndexExistSchema, listItemIndexExistSchema } from './list_item_index_exist_schema';

View file

@ -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 { getListItemResponseMock } from './list_item_schema.mock';
import { ListItemSchema, listItemSchema } from './list_item_schema';

View file

@ -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 { getListResponseMock } from './list_schema.mock';
import { ListSchema, listSchema } from './list_schema';

View file

@ -8,7 +8,7 @@ import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';
import { DATE_NOW } from '../../constants.mock';
import { foldLeftRight, getPaths } from '../../siem_common_deps';
import { foldLeftRight, getPaths } from '../../shared_imports';
import { getCommentsArrayMock, getCommentsMock } from './comment.mock';
import {

View file

@ -8,7 +8,7 @@
import * as t from 'io-ts';
import { NonEmptyString } from '../../siem_common_deps';
import { NonEmptyString } from '../../shared_imports';
import { created_at, created_by, id, updated_at, updated_by } from '../common/schemas';
export const comment = t.intersection([

View file

@ -7,7 +7,7 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';
import { foldLeftRight, getPaths } from '../../siem_common_deps';
import { foldLeftRight, getPaths } from '../../shared_imports';
import { getCreateCommentsArrayMock, getCreateCommentsMock } from './create_comment.mock';
import {

View file

@ -5,7 +5,7 @@
*/
import * as t from 'io-ts';
import { NonEmptyString } from '../../siem_common_deps';
import { NonEmptyString } from '../../shared_imports';
export const createComment = t.exact(
t.type({

View file

@ -7,7 +7,7 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';
import { foldLeftRight, getPaths } from '../../siem_common_deps';
import { foldLeftRight, getPaths } from '../../shared_imports';
import { DefaultCommentsArray } from './default_comments_array';
import { CommentsArray } from './comment';

View file

@ -7,7 +7,7 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';
import { foldLeftRight, getPaths } from '../../siem_common_deps';
import { foldLeftRight, getPaths } from '../../shared_imports';
import { DefaultCreateCommentsArray } from './default_create_comments_array';
import { CreateCommentsArray } from './create_comment';

View file

@ -7,7 +7,7 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';
import { foldLeftRight, getPaths } from '../../siem_common_deps';
import { foldLeftRight, getPaths } from '../../shared_imports';
import { DefaultNamespace } from './default_namespace';
@ -48,7 +48,7 @@ describe('default_namespace', () => {
expect(message.schema).toEqual('single');
});
test('it should NOT validate if not "single" or "agnostic"', () => {
test('it should FAIL validation if not "single" or "agnostic"', () => {
const payload = 'something else';
const decoded = DefaultNamespace.decode(payload);
const message = pipe(decoded, foldLeftRight);

View file

@ -7,7 +7,7 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';
import { foldLeftRight, getPaths } from '../../siem_common_deps';
import { foldLeftRight, getPaths } from '../../shared_imports';
import { DefaultNamespaceArray, DefaultNamespaceArrayType } from './default_namespace_array';
@ -21,7 +21,7 @@ describe('default_namespace_array', () => {
expect(message.schema).toEqual(['single']);
});
test('it should NOT validate a numeric value', () => {
test('it should FAIL validation of numeric value', () => {
const payload = 5;
const decoded = DefaultNamespaceArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -86,7 +86,7 @@ describe('default_namespace_array', () => {
expect(message.schema).toEqual(['single', 'agnostic', 'single']);
});
test('it should not validate 3 elements of "single,agnostic,junk" since the 3rd value is junk', () => {
test('it should FAIL validation when given 3 elements of "single,agnostic,junk" since the 3rd value is junk', () => {
const payload: DefaultNamespaceArrayType = 'single,agnostic,junk';
const decoded = DefaultNamespaceArray.decode(payload);
const message = pipe(decoded, foldLeftRight);

View file

@ -7,7 +7,7 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';
import { foldLeftRight, getPaths } from '../../siem_common_deps';
import { foldLeftRight, getPaths } from '../../shared_imports';
import { DefaultUpdateCommentsArray } from './default_update_comments_array';
import { UpdateCommentsArray } from './update_comment';

View file

@ -7,7 +7,7 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';
import { foldLeftRight, getPaths } from '../../siem_common_deps';
import { foldLeftRight, getPaths } from '../../shared_imports';
import { EmptyStringArray, EmptyStringArrayEncoded } from './empty_string_array';
@ -57,7 +57,7 @@ describe('empty_string_array', () => {
expect(message.schema).toEqual(['a', 'b', 'c']);
});
test('it should NOT validate a number', () => {
test('it should FAIL validation of number', () => {
const payload: number = 5;
const decoded = EmptyStringArray.decode(payload);
const message = pipe(decoded, foldLeftRight);

View file

@ -12,21 +12,18 @@ import { getEntryExistsMock } from './entry_exists.mock';
import { getEntryNestedMock } from './entry_nested.mock';
export const getListAndNonListEntriesArrayMock = (): EntriesArray => [
{ ...getEntryMatchMock() },
{ ...getEntryMatchAnyMock() },
{ ...getEntryListMock() },
{ ...getEntryExistsMock() },
{ ...getEntryNestedMock() },
getEntryMatchMock(),
getEntryMatchAnyMock(),
getEntryListMock(),
getEntryExistsMock(),
getEntryNestedMock(),
];
export const getListEntriesArrayMock = (): EntriesArray => [
{ ...getEntryListMock() },
{ ...getEntryListMock() },
];
export const getListEntriesArrayMock = (): EntriesArray => [getEntryListMock(), getEntryListMock()];
export const getEntriesArrayMock = (): EntriesArray => [
{ ...getEntryMatchMock() },
{ ...getEntryMatchAnyMock() },
{ ...getEntryExistsMock() },
{ ...getEntryNestedMock() },
getEntryMatchMock(),
getEntryMatchAnyMock(),
getEntryExistsMock(),
getEntryNestedMock(),
];

View file

@ -7,7 +7,7 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';
import { foldLeftRight, getPaths } from '../../siem_common_deps';
import { foldLeftRight, getPaths } from '../../shared_imports';
import { getEntryMatchMock } from './entry_match.mock';
import { getEntryMatchAnyMock } from './entry_match_any.mock';
@ -20,7 +20,7 @@ import { entriesArray, entriesArrayOrUndefined, entry } from './entries';
describe('Entries', () => {
describe('entry', () => {
test('it should validate a match entry', () => {
const payload = { ...getEntryMatchMock() };
const payload = getEntryMatchMock();
const decoded = entry.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -29,7 +29,7 @@ describe('Entries', () => {
});
test('it should validate a match_any entry', () => {
const payload = { ...getEntryMatchAnyMock() };
const payload = getEntryMatchAnyMock();
const decoded = entry.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -38,7 +38,7 @@ describe('Entries', () => {
});
test('it should validate a exists entry', () => {
const payload = { ...getEntryExistsMock() };
const payload = getEntryExistsMock();
const decoded = entry.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -47,7 +47,7 @@ describe('Entries', () => {
});
test('it should validate a list entry', () => {
const payload = { ...getEntryListMock() };
const payload = getEntryListMock();
const decoded = entry.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -55,8 +55,8 @@ describe('Entries', () => {
expect(message.schema).toEqual(payload);
});
test('it should NOT validate a nested entry', () => {
const payload = { ...getEntryNestedMock() };
test('it should FAIL validation of nested entry', () => {
const payload = getEntryNestedMock();
const decoded = entry.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -79,7 +79,7 @@ describe('Entries', () => {
describe('entriesArray', () => {
test('it should validate an array with match entry', () => {
const payload = [{ ...getEntryMatchMock() }];
const payload = [getEntryMatchMock()];
const decoded = entriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -88,7 +88,7 @@ describe('Entries', () => {
});
test('it should validate an array with match_any entry', () => {
const payload = [{ ...getEntryMatchAnyMock() }];
const payload = [getEntryMatchAnyMock()];
const decoded = entriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -97,7 +97,7 @@ describe('Entries', () => {
});
test('it should validate an array with exists entry', () => {
const payload = [{ ...getEntryExistsMock() }];
const payload = [getEntryExistsMock()];
const decoded = entriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -106,7 +106,7 @@ describe('Entries', () => {
});
test('it should validate an array with list entry', () => {
const payload = [{ ...getEntryListMock() }];
const payload = [getEntryListMock()];
const decoded = entriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -115,7 +115,7 @@ describe('Entries', () => {
});
test('it should validate an array with nested entry', () => {
const payload = [{ ...getEntryNestedMock() }];
const payload = [getEntryNestedMock()];
const decoded = entriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -144,7 +144,7 @@ describe('Entries', () => {
});
test('it should validate an array with nested entry', () => {
const payload = [{ ...getEntryNestedMock() }];
const payload = [getEntryNestedMock()];
const decoded = entriesArrayOrUndefined.decode(payload);
const message = pipe(decoded, foldLeftRight);

View file

@ -7,14 +7,14 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';
import { foldLeftRight, getPaths } from '../../siem_common_deps';
import { foldLeftRight, getPaths } from '../../shared_imports';
import { getEntryExistsMock } from './entry_exists.mock';
import { EntryExists, entriesExists } from './entry_exists';
describe('entriesExists', () => {
test('it should validate an entry', () => {
const payload = { ...getEntryExistsMock() };
const payload = getEntryExistsMock();
const decoded = entriesExists.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -23,7 +23,7 @@ describe('entriesExists', () => {
});
test('it should validate when "operator" is "included"', () => {
const payload = { ...getEntryExistsMock() };
const payload = getEntryExistsMock();
const decoded = entriesExists.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -32,7 +32,7 @@ describe('entriesExists', () => {
});
test('it should validate when "operator" is "excluded"', () => {
const payload = { ...getEntryExistsMock() };
const payload = getEntryExistsMock();
payload.operator = 'excluded';
const decoded = entriesExists.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -41,7 +41,7 @@ describe('entriesExists', () => {
expect(message.schema).toEqual(payload);
});
test('it should not validate when "field" is empty string', () => {
test('it should FAIL validation when "field" is empty string', () => {
const payload: Omit<EntryExists, 'field'> & { field: string } = {
...getEntryExistsMock(),
field: '',
@ -56,16 +56,16 @@ describe('entriesExists', () => {
test('it should strip out extra keys', () => {
const payload: EntryExists & {
extraKey?: string;
} = { ...getEntryExistsMock() };
} = getEntryExistsMock();
payload.extraKey = 'some extra key';
const decoded = entriesExists.decode(payload);
const message = pipe(decoded, foldLeftRight);
expect(getPaths(left(message.errors))).toEqual([]);
expect(message.schema).toEqual({ ...getEntryExistsMock() });
expect(message.schema).toEqual(getEntryExistsMock());
});
test('it should not validate when "type" is not "exists"', () => {
test('it should FAIL validation when "type" is not "exists"', () => {
const payload: Omit<EntryExists, 'type'> & { type: string } = {
...getEntryExistsMock(),
type: 'match',

View file

@ -8,7 +8,7 @@
import * as t from 'io-ts';
import { NonEmptyString } from '../../siem_common_deps';
import { NonEmptyString } from '../../shared_imports';
import { operator } from '../common/schemas';
export const entriesExists = t.exact(

View file

@ -7,14 +7,14 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';
import { foldLeftRight, getPaths } from '../../siem_common_deps';
import { foldLeftRight, getPaths } from '../../shared_imports';
import { getEntryListMock } from './entry_list.mock';
import { EntryList, entriesList } from './entry_list';
describe('entriesList', () => {
test('it should validate an entry', () => {
const payload = { ...getEntryListMock() };
const payload = getEntryListMock();
const decoded = entriesList.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -23,7 +23,7 @@ describe('entriesList', () => {
});
test('it should validate when operator is "included"', () => {
const payload = { ...getEntryListMock() };
const payload = getEntryListMock();
const decoded = entriesList.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -32,7 +32,7 @@ describe('entriesList', () => {
});
test('it should validate when "operator" is "excluded"', () => {
const payload = { ...getEntryListMock() };
const payload = getEntryListMock();
payload.operator = 'excluded';
const decoded = entriesList.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -41,7 +41,7 @@ describe('entriesList', () => {
expect(message.schema).toEqual(payload);
});
test('it should not validate when "list" is not expected value', () => {
test('it should FAIL validation when "list" is not expected value', () => {
const payload: Omit<EntryList, 'list'> & { list: string } = {
...getEntryListMock(),
list: 'someListId',
@ -55,7 +55,7 @@ describe('entriesList', () => {
expect(message.schema).toEqual({});
});
test('it should not validate when "list.id" is empty string', () => {
test('it should FAIL validation when "list.id" is empty string', () => {
const payload: Omit<EntryList, 'list'> & { list: { id: string; type: 'ip' } } = {
...getEntryListMock(),
list: { id: '', type: 'ip' },
@ -67,7 +67,7 @@ describe('entriesList', () => {
expect(message.schema).toEqual({});
});
test('it should not validate when "type" is not "lists"', () => {
test('it should FAIL validation when "type" is not "lists"', () => {
const payload: Omit<EntryList, 'type'> & { type: 'match_any' } = {
...getEntryListMock(),
type: 'match_any',
@ -84,12 +84,12 @@ describe('entriesList', () => {
test('it should strip out extra keys', () => {
const payload: EntryList & {
extraKey?: string;
} = { ...getEntryListMock() };
} = getEntryListMock();
payload.extraKey = 'some extra key';
const decoded = entriesList.decode(payload);
const message = pipe(decoded, foldLeftRight);
expect(getPaths(left(message.errors))).toEqual([]);
expect(message.schema).toEqual({ ...getEntryListMock() });
expect(message.schema).toEqual(getEntryListMock());
});
});

View file

@ -8,7 +8,7 @@
import * as t from 'io-ts';
import { NonEmptyString } from '../../siem_common_deps';
import { NonEmptyString } from '../../shared_imports';
import { operator, type } from '../common/schemas';
export const entriesList = t.exact(

View file

@ -7,14 +7,14 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';
import { foldLeftRight, getPaths } from '../../siem_common_deps';
import { foldLeftRight, getPaths } from '../../shared_imports';
import { getEntryMatchMock } from './entry_match.mock';
import { EntryMatch, entriesMatch } from './entry_match';
describe('entriesMatch', () => {
test('it should validate an entry', () => {
const payload = { ...getEntryMatchMock() };
const payload = getEntryMatchMock();
const decoded = entriesMatch.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -23,7 +23,7 @@ describe('entriesMatch', () => {
});
test('it should validate when operator is "included"', () => {
const payload = { ...getEntryMatchMock() };
const payload = getEntryMatchMock();
const decoded = entriesMatch.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -32,7 +32,7 @@ describe('entriesMatch', () => {
});
test('it should validate when "operator" is "excluded"', () => {
const payload = { ...getEntryMatchMock() };
const payload = getEntryMatchMock();
payload.operator = 'excluded';
const decoded = entriesMatch.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -41,7 +41,7 @@ describe('entriesMatch', () => {
expect(message.schema).toEqual(payload);
});
test('it should not validate when "field" is empty string', () => {
test('it should FAIL validation when "field" is empty string', () => {
const payload: Omit<EntryMatch, 'field'> & { field: string } = {
...getEntryMatchMock(),
field: '',
@ -53,7 +53,7 @@ describe('entriesMatch', () => {
expect(message.schema).toEqual({});
});
test('it should not validate when "value" is not string', () => {
test('it should FAIL validation when "value" is not string', () => {
const payload: Omit<EntryMatch, 'value'> & { value: string[] } = {
...getEntryMatchMock(),
value: ['some value'],
@ -67,7 +67,7 @@ describe('entriesMatch', () => {
expect(message.schema).toEqual({});
});
test('it should not validate when "value" is empty string', () => {
test('it should FAIL validation when "value" is empty string', () => {
const payload: Omit<EntryMatch, 'value'> & { value: string } = {
...getEntryMatchMock(),
value: '',
@ -79,7 +79,7 @@ describe('entriesMatch', () => {
expect(message.schema).toEqual({});
});
test('it should not validate when "type" is not "match"', () => {
test('it should FAIL validation when "type" is not "match"', () => {
const payload: Omit<EntryMatch, 'type'> & { type: string } = {
...getEntryMatchMock(),
type: 'match_any',
@ -96,12 +96,12 @@ describe('entriesMatch', () => {
test('it should strip out extra keys', () => {
const payload: EntryMatch & {
extraKey?: string;
} = { ...getEntryMatchMock() };
} = getEntryMatchMock();
payload.extraKey = 'some value';
const decoded = entriesMatch.decode(payload);
const message = pipe(decoded, foldLeftRight);
expect(getPaths(left(message.errors))).toEqual([]);
expect(message.schema).toEqual({ ...getEntryMatchMock() });
expect(message.schema).toEqual(getEntryMatchMock());
});
});

View file

@ -8,7 +8,7 @@
import * as t from 'io-ts';
import { NonEmptyString } from '../../siem_common_deps';
import { NonEmptyString } from '../../shared_imports';
import { operator } from '../common/schemas';
export const entriesMatch = t.exact(

View file

@ -7,14 +7,14 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';
import { foldLeftRight, getPaths } from '../../siem_common_deps';
import { foldLeftRight, getPaths } from '../../shared_imports';
import { getEntryMatchAnyMock } from './entry_match_any.mock';
import { EntryMatchAny, entriesMatchAny } from './entry_match_any';
describe('entriesMatchAny', () => {
test('it should validate an entry', () => {
const payload = { ...getEntryMatchAnyMock() };
const payload = getEntryMatchAnyMock();
const decoded = entriesMatchAny.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -23,7 +23,7 @@ describe('entriesMatchAny', () => {
});
test('it should validate when operator is "included"', () => {
const payload = { ...getEntryMatchAnyMock() };
const payload = getEntryMatchAnyMock();
const decoded = entriesMatchAny.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -32,7 +32,7 @@ describe('entriesMatchAny', () => {
});
test('it should validate when operator is "excluded"', () => {
const payload = { ...getEntryMatchAnyMock() };
const payload = getEntryMatchAnyMock();
payload.operator = 'excluded';
const decoded = entriesMatchAny.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -41,7 +41,7 @@ describe('entriesMatchAny', () => {
expect(message.schema).toEqual(payload);
});
test('it should not validate when field is empty string', () => {
test('it should FAIL validation when field is empty string', () => {
const payload: Omit<EntryMatchAny, 'field'> & { field: string } = {
...getEntryMatchAnyMock(),
field: '',
@ -53,7 +53,7 @@ describe('entriesMatchAny', () => {
expect(message.schema).toEqual({});
});
test('it should not validate when value is empty array', () => {
test('it should FAIL validation when value is empty array', () => {
const payload: Omit<EntryMatchAny, 'value'> & { value: string[] } = {
...getEntryMatchAnyMock(),
value: [],
@ -65,7 +65,7 @@ describe('entriesMatchAny', () => {
expect(message.schema).toEqual({});
});
test('it should not validate when value is not string array', () => {
test('it should FAIL validation when value is not string array', () => {
const payload: Omit<EntryMatchAny, 'value'> & { value: string } = {
...getEntryMatchAnyMock(),
value: 'some string',
@ -79,7 +79,7 @@ describe('entriesMatchAny', () => {
expect(message.schema).toEqual({});
});
test('it should not validate when "type" is not "match_any"', () => {
test('it should FAIL validation when "type" is not "match_any"', () => {
const payload: Omit<EntryMatchAny, 'type'> & { type: string } = {
...getEntryMatchAnyMock(),
type: 'match',
@ -94,12 +94,12 @@ describe('entriesMatchAny', () => {
test('it should strip out extra keys', () => {
const payload: EntryMatchAny & {
extraKey?: string;
} = { ...getEntryMatchAnyMock() };
} = getEntryMatchAnyMock();
payload.extraKey = 'some extra key';
const decoded = entriesMatchAny.decode(payload);
const message = pipe(decoded, foldLeftRight);
expect(getPaths(left(message.errors))).toEqual([]);
expect(message.schema).toEqual({ ...getEntryMatchAnyMock() });
expect(message.schema).toEqual(getEntryMatchAnyMock());
});
});

View file

@ -8,7 +8,7 @@
import * as t from 'io-ts';
import { NonEmptyString } from '../../siem_common_deps';
import { NonEmptyString } from '../../shared_imports';
import { operator } from '../common/schemas';
import { nonEmptyOrNullableStringArray } from './non_empty_or_nullable_string_array';

View file

@ -11,7 +11,7 @@ import { getEntryMatchMock } from './entry_match.mock';
import { getEntryMatchAnyMock } from './entry_match_any.mock';
export const getEntryNestedMock = (): EntryNested => ({
entries: [{ ...getEntryMatchMock() }, { ...getEntryMatchAnyMock() }],
entries: [getEntryMatchMock(), getEntryMatchAnyMock()],
field: FIELD,
type: NESTED,
});

View file

@ -7,7 +7,7 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';
import { foldLeftRight, getPaths } from '../../siem_common_deps';
import { foldLeftRight, getPaths } from '../../shared_imports';
import { getEntryNestedMock } from './entry_nested.mock';
import { EntryNested, entriesNested } from './entry_nested';
@ -16,7 +16,7 @@ import { getEntryExistsMock } from './entry_exists.mock';
describe('entriesNested', () => {
test('it should validate a nested entry', () => {
const payload = { ...getEntryNestedMock() };
const payload = getEntryNestedMock();
const decoded = entriesNested.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -24,7 +24,7 @@ describe('entriesNested', () => {
expect(message.schema).toEqual(payload);
});
test('it should NOT validate when "type" is not "nested"', () => {
test('it should FAIL validation when "type" is not "nested"', () => {
const payload: Omit<EntryNested, 'type'> & { type: 'match' } = {
...getEntryNestedMock(),
type: 'match',
@ -36,7 +36,7 @@ describe('entriesNested', () => {
expect(message.schema).toEqual({});
});
test('it should NOT validate when "field" is empty string', () => {
test('it should FAIL validation when "field" is empty string', () => {
const payload: Omit<EntryNested, 'field'> & {
field: string;
} = { ...getEntryNestedMock(), field: '' };
@ -47,7 +47,7 @@ describe('entriesNested', () => {
expect(message.schema).toEqual({});
});
test('it should NOT validate when "field" is not a string', () => {
test('it should FAIL validation when "field" is not a string', () => {
const payload: Omit<EntryNested, 'field'> & {
field: number;
} = { ...getEntryNestedMock(), field: 1 };
@ -58,7 +58,7 @@ describe('entriesNested', () => {
expect(message.schema).toEqual({});
});
test('it should NOT validate when "entries" is not a an array', () => {
test('it should FAIL validation when "entries" is not a an array', () => {
const payload: Omit<EntryNested, 'entries'> & {
entries: string;
} = { ...getEntryNestedMock(), entries: 'im a string' };
@ -72,7 +72,7 @@ describe('entriesNested', () => {
});
test('it should validate when "entries" contains an entry item that is type "match"', () => {
const payload = { ...getEntryNestedMock(), entries: [{ ...getEntryMatchAnyMock() }] };
const payload = { ...getEntryNestedMock(), entries: [getEntryMatchAnyMock()] };
const decoded = entriesNested.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -92,7 +92,7 @@ describe('entriesNested', () => {
});
test('it should validate when "entries" contains an entry item that is type "exists"', () => {
const payload = { ...getEntryNestedMock(), entries: [{ ...getEntryExistsMock() }] };
const payload = { ...getEntryNestedMock(), entries: [getEntryExistsMock()] };
const decoded = entriesNested.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -113,12 +113,12 @@ describe('entriesNested', () => {
test('it should strip out extra keys', () => {
const payload: EntryNested & {
extraKey?: string;
} = { ...getEntryNestedMock() };
} = getEntryNestedMock();
payload.extraKey = 'some extra key';
const decoded = entriesNested.decode(payload);
const message = pipe(decoded, foldLeftRight);
expect(getPaths(left(message.errors))).toEqual([]);
expect(message.schema).toEqual({ ...getEntryNestedMock() });
expect(message.schema).toEqual(getEntryNestedMock());
});
});

View file

@ -8,7 +8,7 @@
import * as t from 'io-ts';
import { NonEmptyString } from '../../siem_common_deps';
import { NonEmptyString } from '../../shared_imports';
import { nonEmptyNestedEntriesArray } from './non_empty_nested_entries_array';

View file

@ -7,7 +7,7 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';
import { foldLeftRight, getPaths } from '../../siem_common_deps';
import { foldLeftRight, getPaths } from '../../shared_imports';
import { getEntryMatchMock } from './entry_match.mock';
import { getEntryMatchAnyMock } from './entry_match_any.mock';
@ -22,7 +22,7 @@ import { nonEmptyEntriesArray } from './non_empty_entries_array';
import { EntriesArray } from './entries';
describe('non_empty_entries_array', () => {
test('it should NOT validate an empty array', () => {
test('it should FAIL validation when given an empty array', () => {
const payload: EntriesArray = [];
const decoded = nonEmptyEntriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -33,7 +33,7 @@ describe('non_empty_entries_array', () => {
expect(message.schema).toEqual({});
});
test('it should NOT validate "undefined"', () => {
test('it should FAIL validation when given "undefined"', () => {
const payload = undefined;
const decoded = nonEmptyEntriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -44,7 +44,7 @@ describe('non_empty_entries_array', () => {
expect(message.schema).toEqual({});
});
test('it should NOT validate "null"', () => {
test('it should FAIL validation when given "null"', () => {
const payload = null;
const decoded = nonEmptyEntriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -56,7 +56,7 @@ describe('non_empty_entries_array', () => {
});
test('it should validate an array of "match" entries', () => {
const payload: EntriesArray = [{ ...getEntryMatchMock() }, { ...getEntryMatchMock() }];
const payload: EntriesArray = [getEntryMatchMock(), getEntryMatchMock()];
const decoded = nonEmptyEntriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -65,7 +65,7 @@ describe('non_empty_entries_array', () => {
});
test('it should validate an array of "match_any" entries', () => {
const payload: EntriesArray = [{ ...getEntryMatchAnyMock() }, { ...getEntryMatchAnyMock() }];
const payload: EntriesArray = [getEntryMatchAnyMock(), getEntryMatchAnyMock()];
const decoded = nonEmptyEntriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -74,7 +74,7 @@ describe('non_empty_entries_array', () => {
});
test('it should validate an array of "exists" entries', () => {
const payload: EntriesArray = [{ ...getEntryExistsMock() }, { ...getEntryExistsMock() }];
const payload: EntriesArray = [getEntryExistsMock(), getEntryExistsMock()];
const decoded = nonEmptyEntriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -92,7 +92,7 @@ describe('non_empty_entries_array', () => {
});
test('it should validate an array of "nested" entries', () => {
const payload: EntriesArray = [{ ...getEntryNestedMock() }, { ...getEntryNestedMock() }];
const payload: EntriesArray = [getEntryNestedMock(), getEntryNestedMock()];
const decoded = nonEmptyEntriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -109,7 +109,7 @@ describe('non_empty_entries_array', () => {
expect(message.schema).toEqual(payload);
});
test('it should NOT validate an array of entries of value list and non-value list entries', () => {
test('it should FAIL validation when given an array of entries of value list and non-value list entries', () => {
const payload: EntriesArray = [...getListAndNonListEntriesArrayMock()];
const decoded = nonEmptyEntriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -118,7 +118,7 @@ describe('non_empty_entries_array', () => {
expect(message.schema).toEqual({});
});
test('it should NOT validate an array of non entries', () => {
test('it should FAIL validation when given an array of non entries', () => {
const payload = [1];
const decoded = nonEmptyEntriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);

View file

@ -7,7 +7,7 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';
import { foldLeftRight, getPaths } from '../../siem_common_deps';
import { foldLeftRight, getPaths } from '../../shared_imports';
import { getEntryMatchMock } from './entry_match.mock';
import { getEntryMatchAnyMock } from './entry_match_any.mock';
@ -17,7 +17,7 @@ import { nonEmptyNestedEntriesArray } from './non_empty_nested_entries_array';
import { EntriesArray } from './entries';
describe('non_empty_nested_entries_array', () => {
test('it should NOT validate an empty array', () => {
test('it should FAIL validation when given an empty array', () => {
const payload: EntriesArray = [];
const decoded = nonEmptyNestedEntriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -28,7 +28,7 @@ describe('non_empty_nested_entries_array', () => {
expect(message.schema).toEqual({});
});
test('it should NOT validate "undefined"', () => {
test('it should FAIL validation when given "undefined"', () => {
const payload = undefined;
const decoded = nonEmptyNestedEntriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -39,7 +39,7 @@ describe('non_empty_nested_entries_array', () => {
expect(message.schema).toEqual({});
});
test('it should NOT validate "null"', () => {
test('it should FAIL validation when given "null"', () => {
const payload = null;
const decoded = nonEmptyNestedEntriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -51,7 +51,7 @@ describe('non_empty_nested_entries_array', () => {
});
test('it should validate an array of "match" entries', () => {
const payload: EntriesArray = [{ ...getEntryMatchMock() }, { ...getEntryMatchMock() }];
const payload: EntriesArray = [getEntryMatchMock(), getEntryMatchMock()];
const decoded = nonEmptyNestedEntriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -60,7 +60,7 @@ describe('non_empty_nested_entries_array', () => {
});
test('it should validate an array of "match_any" entries', () => {
const payload: EntriesArray = [{ ...getEntryMatchAnyMock() }, { ...getEntryMatchAnyMock() }];
const payload: EntriesArray = [getEntryMatchAnyMock(), getEntryMatchAnyMock()];
const decoded = nonEmptyNestedEntriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -69,7 +69,7 @@ describe('non_empty_nested_entries_array', () => {
});
test('it should validate an array of "exists" entries', () => {
const payload: EntriesArray = [{ ...getEntryExistsMock() }, { ...getEntryExistsMock() }];
const payload: EntriesArray = [getEntryExistsMock(), getEntryExistsMock()];
const decoded = nonEmptyNestedEntriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -77,8 +77,8 @@ describe('non_empty_nested_entries_array', () => {
expect(message.schema).toEqual(payload);
});
test('it should NOT validate an array of "nested" entries', () => {
const payload: EntriesArray = [{ ...getEntryNestedMock() }, { ...getEntryNestedMock() }];
test('it should FAIL validation when given an array of "nested" entries', () => {
const payload: EntriesArray = [getEntryNestedMock(), getEntryNestedMock()];
const decoded = nonEmptyNestedEntriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -105,9 +105,9 @@ describe('non_empty_nested_entries_array', () => {
test('it should validate an array of entries', () => {
const payload: EntriesArray = [
{ ...getEntryExistsMock() },
{ ...getEntryMatchAnyMock() },
{ ...getEntryMatchMock() },
getEntryExistsMock(),
getEntryMatchAnyMock(),
getEntryMatchMock(),
];
const decoded = nonEmptyNestedEntriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -116,7 +116,7 @@ describe('non_empty_nested_entries_array', () => {
expect(message.schema).toEqual(payload);
});
test('it should NOT validate an array of non entries', () => {
test('it should FAIL validation when given an array of non entries', () => {
const payload = [1];
const decoded = nonEmptyNestedEntriesArray.decode(payload);
const message = pipe(decoded, foldLeftRight);

View file

@ -7,12 +7,12 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';
import { foldLeftRight, getPaths } from '../../siem_common_deps';
import { foldLeftRight, getPaths } from '../../shared_imports';
import { nonEmptyOrNullableStringArray } from './non_empty_or_nullable_string_array';
describe('nonEmptyOrNullableStringArray', () => {
test('it should NOT validate an empty array', () => {
test('it should FAIL validation when given an empty array', () => {
const payload: string[] = [];
const decoded = nonEmptyOrNullableStringArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -23,7 +23,7 @@ describe('nonEmptyOrNullableStringArray', () => {
expect(message.schema).toEqual({});
});
test('it should NOT validate "undefined"', () => {
test('it should FAIL validation when given "undefined"', () => {
const payload = undefined;
const decoded = nonEmptyOrNullableStringArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -34,7 +34,7 @@ describe('nonEmptyOrNullableStringArray', () => {
expect(message.schema).toEqual({});
});
test('it should NOT validate "null"', () => {
test('it should FAIL validation when given "null"', () => {
const payload = null;
const decoded = nonEmptyOrNullableStringArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -45,7 +45,7 @@ describe('nonEmptyOrNullableStringArray', () => {
expect(message.schema).toEqual({});
});
test('it should NOT validate an array of with an empty string', () => {
test('it should FAIL validation when given an array of with an empty string', () => {
const payload: string[] = ['im good', ''];
const decoded = nonEmptyOrNullableStringArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -56,7 +56,7 @@ describe('nonEmptyOrNullableStringArray', () => {
expect(message.schema).toEqual({});
});
test('it should NOT validate an array of non strings', () => {
test('it should FAIL validation when given an array of non strings', () => {
const payload = [1];
const decoded = nonEmptyOrNullableStringArray.decode(payload);
const message = pipe(decoded, foldLeftRight);

View file

@ -7,12 +7,12 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';
import { foldLeftRight, getPaths } from '../../siem_common_deps';
import { foldLeftRight, getPaths } from '../../shared_imports';
import { NonEmptyStringArray } from './non_empty_string_array';
describe('non_empty_string_array', () => {
test('it should NOT validate "null"', () => {
test('it should FAIL validation when given "null"', () => {
const payload: NonEmptyStringArray | null = null;
const decoded = NonEmptyStringArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -23,7 +23,7 @@ describe('non_empty_string_array', () => {
expect(message.schema).toEqual({});
});
test('it should NOT validate "undefined"', () => {
test('it should FAIL validation when given "undefined"', () => {
const payload: NonEmptyStringArray | undefined = undefined;
const decoded = NonEmptyStringArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -34,7 +34,7 @@ describe('non_empty_string_array', () => {
expect(message.schema).toEqual({});
});
test('it should NOT validate a single value of an empty string ""', () => {
test('it should FAIL validation of single value of an empty string ""', () => {
const payload: NonEmptyStringArray = '';
const decoded = NonEmptyStringArray.decode(payload);
const message = pipe(decoded, foldLeftRight);
@ -72,7 +72,7 @@ describe('non_empty_string_array', () => {
expect(message.schema).toEqual(['a', 'b', 'c']);
});
test('it should NOT validate a number', () => {
test('it should FAIL validation of number', () => {
const payload: number = 5;
const decoded = NonEmptyStringArray.decode(payload);
const message = pipe(decoded, foldLeftRight);

View file

@ -7,7 +7,7 @@
import { pipe } from 'fp-ts/lib/pipeable';
import { left } from 'fp-ts/lib/Either';
import { foldLeftRight, getPaths } from '../../siem_common_deps';
import { foldLeftRight, getPaths } from '../../shared_imports';
import { getUpdateCommentMock, getUpdateCommentsArrayMock } from './update_comment.mock';
import {

View file

@ -5,7 +5,7 @@
*/
import * as t from 'io-ts';
import { NonEmptyString } from '../../siem_common_deps';
import { NonEmptyString } from '../../shared_imports';
import { id } from '../common/schemas';
export const updateComment = t.intersection([

View file

@ -1,9 +0,0 @@
/*
* 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.
*/
// DEPRECATED: Do not add exports to this file; please import from shared_imports instead
export * from './shared_imports';

View file

@ -29,7 +29,7 @@ import {
updateExceptionListItemSchema,
updateExceptionListSchema,
} from '../../common/schemas';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import {
AddEndpointExceptionListProps,

View file

@ -29,7 +29,7 @@ import {
listSchema,
} from '../../common/schemas';
import { LIST_INDEX, LIST_ITEM_URL, LIST_PRIVILEGES_URL, LIST_URL } from '../../common/constants';
import { validateEither } from '../../common/siem_common_deps';
import { validateEither } from '../../common/shared_imports';
import { toError, toPromise } from '../common/fp_utils';
import {

View file

@ -8,7 +8,7 @@ import { IRouter } from 'kibana/server';
import { ENDPOINT_LIST_ID, ENDPOINT_LIST_ITEM_URL } from '../../common/constants';
import { buildRouteValidation, buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import {
CreateEndpointListItemSchemaDecoded,
createEndpointListItemSchema,

View file

@ -8,7 +8,7 @@ import { IRouter } from 'kibana/server';
import { ENDPOINT_LIST_URL } from '../../common/constants';
import { buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import { createEndpointListSchema } from '../../common/schemas';
import { getExceptionListClient } from './utils/get_exception_list_client';

View file

@ -8,7 +8,7 @@ import { IRouter } from 'kibana/server';
import { EXCEPTION_LIST_ITEM_URL } from '../../common/constants';
import { buildRouteValidation, buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import {
CreateExceptionListItemSchemaDecoded,
createExceptionListItemSchema,

View file

@ -8,7 +8,7 @@ import { IRouter } from 'kibana/server';
import { EXCEPTION_LIST_URL } from '../../common/constants';
import { buildRouteValidation, buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import {
CreateExceptionListSchemaDecoded,
createExceptionListSchema,

View file

@ -7,7 +7,7 @@
import { IRouter } from 'kibana/server';
import { buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import { LIST_INDEX } from '../../common/constants';
import { acknowledgeSchema } from '../../common/schemas';

View file

@ -9,7 +9,7 @@ import { IRouter } from 'kibana/server';
import { LIST_ITEM_URL } from '../../common/constants';
import { buildRouteValidation, buildSiemResponse, transformError } from '../siem_server_deps';
import { createListItemSchema, listItemSchema } from '../../common/schemas';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import { getListClient } from '.';

View file

@ -8,7 +8,7 @@ import { IRouter } from 'kibana/server';
import { LIST_URL } from '../../common/constants';
import { buildRouteValidation, buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import { CreateListSchemaDecoded, createListSchema, listSchema } from '../../common/schemas';
import { getListClient } from '.';

View file

@ -8,7 +8,7 @@ import { IRouter } from 'kibana/server';
import { ENDPOINT_LIST_ITEM_URL } from '../../common/constants';
import { buildRouteValidation, buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import {
DeleteEndpointListItemSchemaDecoded,
deleteEndpointListItemSchema,

View file

@ -8,7 +8,7 @@ import { IRouter } from 'kibana/server';
import { EXCEPTION_LIST_ITEM_URL } from '../../common/constants';
import { buildRouteValidation, buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import {
DeleteExceptionListItemSchemaDecoded,
deleteExceptionListItemSchema,

View file

@ -8,7 +8,7 @@ import { IRouter } from 'kibana/server';
import { EXCEPTION_LIST_URL } from '../../common/constants';
import { buildRouteValidation, buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import {
DeleteExceptionListSchemaDecoded,
deleteExceptionListSchema,

View file

@ -8,7 +8,7 @@ import { IRouter } from 'kibana/server';
import { LIST_INDEX } from '../../common/constants';
import { buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import { acknowledgeSchema } from '../../common/schemas';
import { getListClient } from '.';

View file

@ -8,7 +8,7 @@ import { IRouter } from 'kibana/server';
import { LIST_ITEM_URL } from '../../common/constants';
import { buildRouteValidation, buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import { deleteListItemSchema, listItemArraySchema, listItemSchema } from '../../common/schemas';
import { getListClient } from '.';

View file

@ -8,7 +8,7 @@ import { IRouter } from 'kibana/server';
import { LIST_URL } from '../../common/constants';
import { buildRouteValidation, buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import { deleteListSchema, listSchema } from '../../common/schemas';
import { getListClient } from '.';

View file

@ -8,7 +8,7 @@ import { IRouter } from 'kibana/server';
import { ENDPOINT_LIST_ID, ENDPOINT_LIST_ITEM_URL } from '../../common/constants';
import { buildRouteValidation, buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import {
FindEndpointListItemSchemaDecoded,
findEndpointListItemSchema,

View file

@ -8,7 +8,7 @@ import { IRouter } from 'kibana/server';
import { EXCEPTION_LIST_ITEM_URL } from '../../common/constants';
import { buildRouteValidation, buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import {
FindExceptionListItemSchemaDecoded,
findExceptionListItemSchema,

View file

@ -8,7 +8,7 @@ import { IRouter } from 'kibana/server';
import { EXCEPTION_LIST_URL } from '../../common/constants';
import { buildRouteValidation, buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import {
FindExceptionListSchemaDecoded,
findExceptionListSchema,

View file

@ -8,7 +8,7 @@ import { IRouter } from 'kibana/server';
import { LIST_ITEM_URL } from '../../common/constants';
import { buildRouteValidation, buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import {
FindListItemSchemaDecoded,
findListItemSchema,

View file

@ -8,7 +8,7 @@ import { IRouter } from 'kibana/server';
import { LIST_URL } from '../../common/constants';
import { buildRouteValidation, buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import { findListSchema, foundListSchema } from '../../common/schemas';
import { decodeCursor } from '../services/utils';

View file

@ -9,7 +9,7 @@ import { schema } from '@kbn/config-schema';
import { LIST_ITEM_URL } from '../../common/constants';
import { buildRouteValidation, buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import { importListItemQuerySchema, listSchema } from '../../common/schemas';
import { ConfigType } from '../config';

View file

@ -8,7 +8,7 @@ import { IRouter } from 'kibana/server';
import { LIST_ITEM_URL } from '../../common/constants';
import { buildRouteValidation, buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import { listItemSchema, patchListItemSchema } from '../../common/schemas';
import { getListClient } from '.';

View file

@ -8,7 +8,7 @@ import { IRouter } from 'kibana/server';
import { LIST_URL } from '../../common/constants';
import { buildRouteValidation, buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import { listSchema, patchListSchema } from '../../common/schemas';
import { getListClient } from '.';

View file

@ -8,7 +8,7 @@ import { IRouter } from 'kibana/server';
import { ENDPOINT_LIST_ITEM_URL } from '../../common/constants';
import { buildRouteValidation, buildSiemResponse, transformError } from '../siem_server_deps';
import { validate } from '../../common/siem_common_deps';
import { validate } from '../../common/shared_imports';
import {
ReadEndpointListItemSchemaDecoded,
exceptionListItemSchema,

Some files were not shown because too many files have changed in this diff Show more