format
This commit is contained in:
Родитель
877eb501d7
Коммит
eb6001cc27
|
@ -1,5 +1,5 @@
|
|||
import {actionStatus} from '../../src/functions/action-status'
|
||||
import { truncateCommentBody } from '../../src/functions/truncate-comment-body'
|
||||
import {truncateCommentBody} from '../../src/functions/truncate-comment-body'
|
||||
|
||||
var context
|
||||
var octokit
|
||||
|
@ -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 () => {
|
||||
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({
|
||||
body: truncateCommentBody(message),
|
||||
issue_number: 1,
|
||||
|
@ -179,4 +181,4 @@ test('truncates the message when it is too large for an issue comment', async ()
|
|||
reaction_id: 123,
|
||||
repo: 'test'
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { truncateCommentBody } from '../../src/functions/truncate-comment-body'
|
||||
import {truncateCommentBody} from '../../src/functions/truncate-comment-body'
|
||||
|
||||
test('truncates a long message', () => {
|
||||
const message = 'a'.repeat(65537)
|
||||
|
@ -8,7 +8,6 @@ test('truncates a long message', () => {
|
|||
|
||||
test('does not truncate a short message', () => {
|
||||
const message = 'a'.repeat(65536)
|
||||
const got= truncateCommentBody(message)
|
||||
const got = truncateCommentBody(message)
|
||||
expect(got).toEqual(message)
|
||||
})
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { truncateCommentBody } from "./truncate-comment-body"
|
||||
import {truncateCommentBody} from './truncate-comment-body'
|
||||
|
||||
// Default failure reaction
|
||||
const thumbsDown = '-1'
|
||||
|
|
|
@ -12,6 +12,9 @@ export function truncateCommentBody(message) {
|
|||
if (message.length <= maxCommentLength) {
|
||||
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
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче