-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d9abe83
commit 418ad3a
Showing
7 changed files
with
112 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
x-pack/plugins/security_solution/public/assistant/get_comments/index.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { getComments } from '.'; | ||
|
||
describe('getComments', () => { | ||
it('Does not add error state message has no error', () => { | ||
const currentConversation = { | ||
apiConfig: {}, | ||
id: '1', | ||
messages: [ | ||
{ | ||
role: 'user', | ||
content: 'Hello {name}', | ||
timestamp: '2022-01-01', | ||
isError: false, | ||
}, | ||
], | ||
}; | ||
const lastCommentRef = { current: null }; | ||
const showAnonymizedValues = false; | ||
|
||
const result = getComments({ currentConversation, lastCommentRef, showAnonymizedValues }); | ||
expect(result[0].eventColor).toEqual(undefined); | ||
}); | ||
it('Adds error state when message has error', () => { | ||
const currentConversation = { | ||
apiConfig: {}, | ||
id: '1', | ||
messages: [ | ||
{ | ||
role: 'user', | ||
content: 'Hello {name}', | ||
timestamp: '2022-01-01', | ||
isError: true, | ||
}, | ||
], | ||
}; | ||
const lastCommentRef = { current: null }; | ||
const showAnonymizedValues = false; | ||
|
||
const result = getComments({ currentConversation, lastCommentRef, showAnonymizedValues }); | ||
expect(result[0].eventColor).toEqual('danger'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters