mirror of https://github.com/actions/toolkit
summary: method to clear file and buffer
parent
d27bf857e6
commit
339dd63bec
|
@ -151,6 +151,13 @@ describe('@actions/core/src/markdown-summary', () => {
|
|||
expect(markdownSummary.isEmptyBuffer()).toBe(true)
|
||||
})
|
||||
|
||||
it('clears a buffer and summary file', async () => {
|
||||
await fs.promises.writeFile(testFilePath, 'content', {encoding: 'utf8'})
|
||||
await markdownSummary.clear()
|
||||
await assertSummary('')
|
||||
expect(markdownSummary.isEmptyBuffer()).toBe(true)
|
||||
})
|
||||
|
||||
it('adds EOL', async () => {
|
||||
await markdownSummary
|
||||
.addRaw(fixtures.text)
|
||||
|
|
|
@ -151,6 +151,15 @@ class MarkdownSummary {
|
|||
return this.emptyBuffer()
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the summary buffer and wipes the summary file
|
||||
*
|
||||
* @returns {MarkdownSummary} markdown summary instance
|
||||
*/
|
||||
async clear(): Promise<MarkdownSummary> {
|
||||
return this.emptyBuffer().write(true)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current summary buffer as a string
|
||||
*
|
||||
|
@ -170,7 +179,7 @@ class MarkdownSummary {
|
|||
}
|
||||
|
||||
/**
|
||||
* Clears the summary buffer without writing to summary file
|
||||
* Resets the summary buffer without writing to summary file
|
||||
*
|
||||
* @returns {MarkdownSummary} markdown summary instance
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue