Skip to content

Commit

Permalink
Merge pull request #2308 from alphagov/flaky-text-fix
Browse files Browse the repository at this point in the history
Checking before deleting as it sometimes fails when testing
  • Loading branch information
BenSurgisonGDS authored Aug 24, 2023
2 parents 6f7b514 + 2c2943d commit 6901834
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/sync-changes.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ function flagError (error) {
}

function unflagError () {
fs.unlinkSync(errorsFile)
if (fs.existsSync(errorsFile)) {
fs.unlinkSync(errorsFile)
}
}

function pageLoaded () {
Expand Down
2 changes: 1 addition & 1 deletion lib/sync-changes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('sync-changes', () => {

syncChanges.pageLoaded()

expect(fs.existsSync).toHaveBeenCalledTimes(3)
expect(fs.existsSync).toHaveBeenCalledTimes(4)
expect(fs.existsSync).toHaveBeenCalledWith(errorsFile)

expect(fs.unlinkSync).toHaveBeenCalledTimes(1)
Expand Down

0 comments on commit 6901834

Please sign in to comment.