Skip to content

Commit

Permalink
Fixes from PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankHassanabad committed Nov 7, 2020
1 parent 068f6f2 commit 3a5c86e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ describe('rules_schema', () => {
expect(fields).toEqual(expected);
});

test('should return 5 fields for a rule of type "threat_match"', () => {
test('should return 8 fields for a rule of type "threat_match"', () => {
const fields = addThreatMatchFields({ type: 'threat_match' });
expect(fields.length).toEqual(8);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('threat_mapping', () => {
expect(message.schema).toEqual(payload);
});

test('it should NOT validate an extra entry item', () => {
test('it should fail validation with an extra entry item', () => {
const payload: ThreatMappingEntries & Array<{ extra: string }> = [
{
field: 'field.one',
Expand All @@ -52,7 +52,7 @@ describe('threat_mapping', () => {
expect(message.schema).toEqual({});
});

test('it should NOT validate a non string', () => {
test('it should fail validation with a non string', () => {
const payload = ([
{
field: 5,
Expand All @@ -68,7 +68,7 @@ describe('threat_mapping', () => {
expect(message.schema).toEqual({});
});

test('it should NOT validate a wrong type', () => {
test('it should fail validation with a wrong type', () => {
const payload = ([
{
field: 'field.one',
Expand Down Expand Up @@ -109,7 +109,7 @@ describe('threat_mapping', () => {
});
});

test('it should NOT validate an extra key', () => {
test('it should fail validate with an extra key', () => {
const payload: ThreatMapping & Array<{ extra: string }> = [
{
entries: [
Expand All @@ -131,7 +131,7 @@ describe('threat_mapping', () => {
expect(message.schema).toEqual({});
});

test('it should NOT validate an extra inner entry', () => {
test('it should fail validate with an extra inner entry', () => {
const payload: ThreatMapping & Array<{ entries: Array<{ extra: string }> }> = [
{
entries: [
Expand All @@ -153,7 +153,7 @@ describe('threat_mapping', () => {
expect(message.schema).toEqual({});
});

test('it should NOT validate an extra inner entry with the wrong data type', () => {
test('it should fail validate with an extra inner entry with the wrong data type', () => {
const payload = ([
{
entries: [
Expand All @@ -176,7 +176,7 @@ describe('threat_mapping', () => {
expect(message.schema).toEqual({});
});

test('it should not validate concurrent_searches if it is < 0', () => {
test('it should fail validation when concurrent_searches is < 0', () => {
const payload = -1;
const decoded = concurrent_searches.decode(payload);
const checked = exactCheck(payload, decoded);
Expand All @@ -187,7 +187,7 @@ describe('threat_mapping', () => {
expect(message.schema).toEqual({});
});

test('it should not validate concurrent_searches if it is 0', () => {
test('it should fail validation when concurrent_searches is 0', () => {
const payload = 0;
const decoded = concurrent_searches.decode(payload);
const checked = exactCheck(payload, decoded);
Expand All @@ -198,7 +198,7 @@ describe('threat_mapping', () => {
expect(message.schema).toEqual({});
});

test('it should not validate items_per_search if it is 0', () => {
test('it should fail validation when items_per_search is 0', () => {
const payload = 0;
const decoded = items_per_search.decode(payload);
const checked = exactCheck(payload, decoded);
Expand All @@ -209,7 +209,7 @@ describe('threat_mapping', () => {
expect(message.schema).toEqual({});
});

test('it should not validate items_per_search if it < 0', () => {
test('it should fail validation when items_per_search is < 0', () => {
const payload = -1;
const decoded = items_per_search.decode(payload);
const checked = exactCheck(payload, decoded);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,7 @@ export const createThreatSignals = async ({

while (threatList.hits.hits.length !== 0) {
const chunks = chunk(itemsPerSearch, threatList.hits.hits);
logger.debug(
buildRuleMessage(
`${chunks.length} concurrent indicator searches are starting. Each search can have up to ${itemsPerSearch} indicator items per search`
)
);
logger.debug(buildRuleMessage(`${chunks.length} concurrent indicator searches are starting.`));
const concurrentSearchesPerformed = chunks.map<Promise<SearchAfterAndBulkCreateReturnType>>(
(slicedChunk) =>
createThreatSignal({
Expand Down

0 comments on commit 3a5c86e

Please sign in to comment.