format
This commit is contained in:
Родитель
877eb501d7
Коммит
eb6001cc27
|
@ -160,7 +160,9 @@ test('uses default log url when the "message" variable is empty for a success',
|
||||||
|
|
||||||
test('truncates the message when it is too large for an issue comment', async () => {
|
test('truncates the message when it is too large for an issue comment', async () => {
|
||||||
const message = 'a'.repeat(65538)
|
const message = 'a'.repeat(65538)
|
||||||
expect(await actionStatus(context, octokit, 123, message, true)).toBe(undefined)
|
expect(await actionStatus(context, octokit, 123, message, true)).toBe(
|
||||||
|
undefined
|
||||||
|
)
|
||||||
expect(octokit.rest.issues.createComment).toHaveBeenCalledWith({
|
expect(octokit.rest.issues.createComment).toHaveBeenCalledWith({
|
||||||
body: truncateCommentBody(message),
|
body: truncateCommentBody(message),
|
||||||
issue_number: 1,
|
issue_number: 1,
|
||||||
|
|
|
@ -11,4 +11,3 @@ test('does not truncate a short message', () => {
|
||||||
const got = truncateCommentBody(message)
|
const got = truncateCommentBody(message)
|
||||||
expect(got).toEqual(message)
|
expect(got).toEqual(message)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { truncateCommentBody } from "./truncate-comment-body"
|
import {truncateCommentBody} from './truncate-comment-body'
|
||||||
|
|
||||||
// Default failure reaction
|
// Default failure reaction
|
||||||
const thumbsDown = '-1'
|
const thumbsDown = '-1'
|
||||||
|
|
|
@ -12,6 +12,9 @@ export function truncateCommentBody(message) {
|
||||||
if (message.length <= maxCommentLength) {
|
if (message.length <= maxCommentLength) {
|
||||||
return message
|
return message
|
||||||
}
|
}
|
||||||
let truncated = message.substring(0, maxCommentLength - truncatedMessageStart.length - truncatedMessageEnd.length)
|
let truncated = message.substring(
|
||||||
|
0,
|
||||||
|
maxCommentLength - truncatedMessageStart.length - truncatedMessageEnd.length
|
||||||
|
)
|
||||||
return truncatedMessageStart + truncated + truncatedMessageEnd
|
return truncatedMessageStart + truncated + truncatedMessageEnd
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче