mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-03-22 19:05:56 -04:00
test(unit): add fixes for newer jest
This commit is contained in:
parent
edb224c53a
commit
32b839a0d6
3 changed files with 11 additions and 1 deletions
test/unit
|
@ -177,6 +177,7 @@ describe('Compose Comment test', () => {
|
|||
|
||||
test('Comment Status initialized properly when muted', () => {
|
||||
jest.useFakeTimers();
|
||||
jest.spyOn(global, 'setTimeout');
|
||||
const realDateNow = Date.now.bind(global.Date);
|
||||
global.Date.now = () => 0;
|
||||
const mutedStore = mockStore({
|
||||
|
|
|
@ -12,6 +12,8 @@ describe('Navigation', () => {
|
|||
beforeEach(() => {
|
||||
store = null;
|
||||
jest.useFakeTimers();
|
||||
jest.spyOn(global, 'setTimeout');
|
||||
jest.spyOn(global, 'clearTimeout');
|
||||
});
|
||||
|
||||
const getNavigationWrapper = props => {
|
||||
|
|
|
@ -13,9 +13,16 @@ const {
|
|||
|
||||
|
||||
describe('unit test lib/validate.js', () => {
|
||||
const realLocation = global.window.location;
|
||||
|
||||
beforeEach(() => {
|
||||
// mock window navigation
|
||||
global.window.location.assign = jest.fn();
|
||||
// see https://stackoverflow.com/q/46169824
|
||||
delete global.window.location;
|
||||
global.window.location = {
|
||||
...realLocation,
|
||||
assign: jest.fn()
|
||||
};
|
||||
});
|
||||
|
||||
test('initialState', () => {
|
||||
|
|
Loading…
Reference in a new issue