Unverified Commit a6cd200f authored by bugclerk's avatar bugclerk Committed by GitHub
Browse files

NAS-123762: Fix JIRA token in File Ticket form (#8854)

(cherry picked from commit 95ccd352

)
Co-authored-by: default avatarDenys Butenko <ua13dark@gmail.com>
No related merge requests found
Showing with 13 additions and 5 deletions
+13 -5
......@@ -56,6 +56,9 @@ export class JiraOauthComponent implements ControlValueAccessor {
doAuth(message: OauthJiraMessage): void {
const token = message.data as string;
if (typeof token !== 'string') {
return;
}
this.input(token);
this.cdr.markForCheck();
}
......
......@@ -30,6 +30,11 @@ describe('FileTicketFormComponent', () => {
let loader: HarnessLoader;
let ws: WebSocketService;
const mockToken = JSON.stringify({
oauth_token: 'mock.oauth.token',
oauth_token_secret: 'mock.oauth.token.secret',
});
const mockNewTicketResponse = {
ticket: 123456789,
url: 'https://mock.jira/ticket',
......@@ -71,7 +76,7 @@ describe('FileTicketFormComponent', () => {
mockProvider(IxSlideInService),
mockProvider(FormErrorHandlerService),
mockProvider(SystemGeneralService, {
getTokenForJira: jest.fn(() => 'token.is.mocked'),
getTokenForJira: jest.fn(() => mockToken),
setTokenForJira: jest.fn(),
}),
mockProvider(IxSlideInRef),
......@@ -91,7 +96,7 @@ describe('FileTicketFormComponent', () => {
expect(values).toEqual(
{
Token: 'token.is.mocked',
Token: mockToken,
'Attach screenshots': [],
Category: '',
Subject: '',
......@@ -100,13 +105,13 @@ describe('FileTicketFormComponent', () => {
'Attach Debug': false,
},
);
expect(ws.call).toHaveBeenCalledWith('support.fetch_categories', ['token.is.mocked']);
expect(ws.call).toHaveBeenCalledWith('support.fetch_categories', [mockToken]);
});
it('sends a create payload to websocket', async () => {
const form = await loader.getHarness(IxFormHarness);
await form.fillForm({
Token: 'token.is.mocked',
Token: mockToken,
Category: 'WebUI',
Subject: 'Test subject',
Body: 'Testing ticket body',
......@@ -120,7 +125,7 @@ describe('FileTicketFormComponent', () => {
body: 'Testing ticket body',
category: '10004',
title: 'Test subject',
token: 'token.is.mocked',
token: mockToken,
type: 'BUG',
}]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment