{"size": 1046, "ext": "js", "max_stars_repo_path": "packages/animation/src/makeIsOutsourced/makeIsOutsourced.test.js", "max_stars_repo_name": "AnnaGingle/arwes", "max_stars_repo_stars_event_min_datetime": "2021-07-01T01:42:56.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-01T01:42:56.000Z", "max_issues_repo_path": "packages/animation/src/makeIsOutsourced/makeIsOutsourced.test.js", "max_issues_repo_name": "AnnaGingle/arwes", "max_issues_repo_issues_event_min_datetime": "2021-09-20T22:42:18.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T02:15:28.000Z", "max_forks_repo_path": "packages/animation/src/makeIsOutsourced/makeIsOutsourced.test.js", "max_forks_repo_name": "AnnaGingle/arwes", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 2, "max_forks_count": null, "avg_line_length": 25.512195122, "max_line_length": 54, "alphanum_fraction": 0.6357552581}
/* eslint-env jest */

import { STREAM } from '../constants';
import { makeIsOutsourced } from './makeIsOutsourced';

test('Should return false by default', () => {
  const component = {
    props: {},
    isRoot: jest.fn(() => false)
  };
  const isOutsourced = makeIsOutsourced(component);
  expect(isOutsourced()).toBe(false);
});

test('Should return false if root', () => {
  const component = {
    props: {},
    isRoot: jest.fn(() => true)
  };
  const isOutsourced = makeIsOutsourced(component);
  expect(isOutsourced()).toBe(false);
});

test('Should return true if imperative', () => {
  const component = {
    props: { imperative: true },
    isRoot: jest.fn(() => false)
  };
  const isOutsourced = makeIsOutsourced(component);
  expect(isOutsourced()).toBe(true);
});

test('Should return true if parent is stream', () => {
  const component = {
    props: { parentEnergyContext: { type: STREAM } },
    isRoot: jest.fn(() => false)
  };
  const isOutsourced = makeIsOutsourced(component);
  expect(isOutsourced()).toBe(true);
});
