Skip to content

Commit

Permalink
Use jest fake time
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen authored and JanAckermann committed Feb 3, 2022
1 parent d4b887d commit 18d36ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ localVue.use(GetTextPlugin, {
silent: true
})

beforeEach(mockAxios.reset)

const composables = '@files/src/composables/index'
jest.mock(composables, () => ({
Expand All @@ -27,8 +26,16 @@ jest.mock(composables, () => ({
})
}))

beforeEach(mockAxios.reset)

beforeEach(() => {
jest.useFakeTimers('modern')
jest.setSystemTime(new Date(2020, 3, 1))
})

afterEach(() => {
jest.unmock(composables)
jest.useRealTimers()
})

window.ResizeObserver =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ exports[`Spaces project component resources should show resources if given 1`] =
</div>
</td>
<td class="oc-td oc-table-cell oc-table-cell-align-right oc-table-cell-align-middle oc-table-cell-width-auto oc-text-nowrap oc-table-data-cell oc-table-data-cell-size"><span class="oc-resource-size">7.5 MB</span></td>
<td class="oc-td oc-table-cell oc-table-cell-align-right oc-table-cell-align-middle oc-table-cell-width-auto oc-text-nowrap oc-table-data-cell oc-table-data-cell-mdate" aria-label="7 months ago (June 14, 2021, 9:41 AM UTC)"><span tabindex="0">7 months ago</span></td>
<td class="oc-td oc-table-cell oc-table-cell-align-right oc-table-cell-align-middle oc-table-cell-width-auto oc-text-nowrap oc-table-data-cell oc-table-data-cell-mdate" aria-label="in 1 year (June 14, 2021, 11:41 AM GMT+2)"><span tabindex="0">in 1 year</span></td>
<td class="oc-td oc-table-cell oc-table-cell-align-right oc-table-cell-align-middle oc-table-cell-width-auto oc-text-nowrap oc-table-data-cell oc-table-data-cell-actions oc-pr-s">
<div class="resource-table-actions"> <button aria-label="Show context menu" class="resource-table-btn-action-dropdown oc-button oc-button-m oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-raw" id="context-menu-trigger-3861"><span class="oc-icon oc-icon-m oc-icon-passive"><!----></span></button>
<div id="context-menu-drop-3861" class="oc-drop oc-box-shadow-medium oc-drop-rounded" style="box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.12);"></div>
Expand Down

0 comments on commit 18d36ab

Please sign in to comment.