Skip to content

Commit

Permalink
update clear files
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunlumbcgov committed Dec 6, 2023
1 parent 70800f8 commit eb5c09d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions backend/src/routes/download-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ async function flushFileCache(req, res) {
}
fileCache.flushAll();
schoolCache.flushAll();
const directoryPath = FILE_STORAGE_DIR ;
// Read all files in the directory
fs.readdirSync(directoryPath).forEach((file) => {
const filePath = path.join(directoryPath, file);

// Delete each file
fs.unlinkSync(filePath);
});

res.status(200).send('All files in the directory deleted successfully.');
} catch (error) {
console.error(error);
Expand Down
4 changes: 2 additions & 2 deletions tests-e2e/cypress/e2e/authority.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ describe('Testing Authority Page', () => {

before(() => {
// Visit the root URL before running any test case.
cy.visit('/authority/100-Abbotsford%20Christian%20School');
cy.visit('/authority/104-Cedars%20Christian%20School');
cy.wait(5000); // 5000 milliseconds = 5 seconds
});

it('Confirm the Authority is displaying', () => {
cy.contains('h1', '100 - Abbotsford Christian School');
cy.contains('h1', '104 - Cedars Christian School');
});
});

0 comments on commit eb5c09d

Please sign in to comment.