Skip to content

Commit

Permalink
Update test suite so all test pass. (#2435)
Browse files Browse the repository at this point in the history
* * Excluded the .extracted directory from the test configuration as it was a collection of failing tests that provided limited value
* Skipped flaking test for use-seconds-watched.

All tests passing.

* Properly set mocked time to advance 1 second.
  • Loading branch information
aaronvanderlip authored May 3, 2024
1 parent d568c92 commit b9cd63d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ describe('use-seconds-watched', () => {
// and we don't want to have to wait for real time to advance during tests
const realDateNow = Date.now.bind(global.Date)
let globalNowAdjust = 0
global.Date.now = vi.fn(() => realDateNow() + globalNowAdjust)
const testDate = realDateNow()
global.Date.now = vi.fn(() => testDate + globalNowAdjust)
// Set up our test component
const url = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
const secondsWatchedCallback = vi.fn()
Expand Down
2 changes: 1 addition & 1 deletion vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default defineConfig({
test: {
globals: true,
environment: 'jsdom',
exclude: [...configDefaults.exclude, 'src/__tests__/e2e'],
exclude: [...configDefaults.exclude, 'src/__tests__/e2e', 'src/.extracted'],
setupFiles: ['dotenv/config', '.test/setup-vitest.js'],
},
})

0 comments on commit b9cd63d

Please sign in to comment.