Skip to content

Commit

Permalink
remove todos already addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
WafaaNasr committed Feb 6, 2023
1 parent 2da1121 commit eb6dfe5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ import { importRulesRoute } from './route';

jest.mock('../../../../../machine_learning/authz');

// TODO add tests for connectors

describe('Import rules route', () => {
let config: ReturnType<typeof createMockConfig>;
let server: ReturnType<typeof serverMock.create>;
Expand Down Expand Up @@ -115,37 +113,6 @@ describe('Import rules route', () => {
action_connectors_errors: [],
});
});
test('returns a 403 error object if importing actions connectors fails', async () => {
(buildMlAuthz as jest.Mock).mockReturnValueOnce({
validateRuleType: jest
.fn()
.mockResolvedValue({ valid: false, message: 'mocked validation message' }),
});

const response = await server.inject(request, requestContextMock.convertContext(context));
expect(response.status).toEqual(200);
expect(response.body).toEqual({
errors: [
{
error: {
message: 'mocked validation message',
status_code: 403,
},
rule_id: 'rule-1',
},
],
success: false,
success_count: 0,
rules_count: 1,
exceptions_errors: [],
exceptions_success: true,
exceptions_success_count: 0,
action_connectors_success: true,
action_connectors_success_count: 0,
action_connectors_warnings: [],
action_connectors_errors: [],
});
});

test('returns error if createRulesAndExceptionsStreamFromNdJson throws error', async () => {
const transformMock = jest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const handleActionConnectorsErrors = (error: ErrorType, id?: string): Bul
statusCode: 500,
message:
(error as ConflictError)?.type === 'conflict'
? 'There is a conflict' // TODO : choose a message when conflict happen
? 'There is a conflict'
: (error as Error).message
? (error as Error).message
: '',
Expand Down

0 comments on commit eb6dfe5

Please sign in to comment.