react-native-desktop
Version:
A framework for building native desktop apps using React
45 lines (36 loc) • 1.28 kB
JavaScript
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*/
;
jest.dontMock('InteractionMixin');
describe('InteractionMixin', () => {
var InteractionManager;
var InteractionMixin;
var component;
beforeEach(() => {
jest.resetModuleRegistry();
InteractionManager = require('InteractionManager');
InteractionMixin = require('InteractionMixin');
component = Object.create(InteractionMixin);
});
it('should start interactions', () => {
var timeout = 123;
component.createInteractionHandle(timeout);
expect(InteractionManager.createInteractionHandle).toBeCalled(timeout);
});
it('should end interactions', () => {
var handle = {};
component.clearInteractionHandle(handle);
expect(InteractionManager.clearInteractionHandle).toBeCalledWith(handle);
});
it('should schedule tasks', () => {
var task = jest.genMockFunction();
component.runAfterInteractions(task);
expect(InteractionManager.runAfterInteractions).toBeCalledWith(task);
});
it('should end unfinished interactions in componentWillUnmount', () => {
var handle = component.createInteractionHandle();
component.componentWillUnmount();
expect(InteractionManager.clearInteractionHandle).toBeCalledWith(handle);
});
});