Skip to content

Commit

Permalink
Add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Jun 14, 2021
1 parent 949ffbf commit 20674aa
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
24 changes: 24 additions & 0 deletions e2e/fake-time/legacy/requestAnimationFrame/__tests__/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

test('requestAnimationFrame', () => {
jest.useFakeTimers('legacy');
let exited = false;
requestAnimationFrame(() => {
exited = true;
});

jest.advanceTimersByTime(15);

expect(exited).toBe(false);

jest.advanceTimersByTime(1);

expect(exited).toBe(true);
});
5 changes: 5 additions & 0 deletions e2e/fake-time/legacy/requestAnimationFrame/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"jest": {
"testEnvironment": "jsdom"
}
}
24 changes: 24 additions & 0 deletions e2e/fake-time/modern/requestAnimationFrame/__tests__/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

test('requestAnimationFrame', () => {
jest.useFakeTimers('legacy');
let exited = false;
requestAnimationFrame(() => {
exited = true;
});

jest.advanceTimersByTime(15);

expect(exited).toBe(false);

jest.advanceTimersByTime(1);

expect(exited).toBe(true);
});
5 changes: 5 additions & 0 deletions e2e/fake-time/modern/requestAnimationFrame/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"jest": {
"testEnvironment": "jsdom"
}
}

0 comments on commit 20674aa

Please sign in to comment.