/**
 * Copyright (c) 2016-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */ import * as List from '../list' ; import * as Maybe from '../maybe' ; import * as PluginInclusionUtils from '../plugin-inclusion-utils' ; import * as ObjectSpec from '../object-spec' ; describe ( 'PluginInclusionUtils' , function ( ) { describe ( '#includesContainingDefaultIncludes' , function ( ) { it ( 'returns includes containing the provided default include' , function ( ) { const includesFromType = [ ] ; const excludesFromType = [ ] ; const defaultIncludes = List . of < string > ( 'SomeDefault' ) ; const includes = PluginInclusionUtils . includesContainingDefaultIncludes ( includesFromType , excludesFromType , defaultIncludes ) ; const expectedIncludes = [ 'SomeDefault' ] ; expect ( includes ) . toEqualJSON ( expectedIncludes ) ; } ) ; it ( 'returns includes containing the provided default include as well as its own ' + 'include which is supplied' , function ( ) { const includesFromType = [ 'SomeAlreadyIncludedThang' ] ; const excludesFromType = [ ] ; const defaultIncludes = List . of < string > ( 'SomeDefault' ) ; const includes = PluginInclusionUtils . includesContainingDefaultIncludes ( includesFromType , excludesFromType , defaultIncludes ) ; const expectedIncludes = [ 'SomeAlreadyIncludedThang' , 'SomeDefault' , ] ; expect ( includes ) . toEqualJSON ( expectedIncludes ) ; } ) ; it ( 'returns includes containing the provided default include as well as two of its own ' + 'includes which are supplied' , function ( ) { const includesFromType = [ 'SomeAlreadyIncludedThang' , 'Another' , ] ; const excludesFromType = [ ] ; const defaultIncludes = List . of < string > ( 'SomeDefault' ) ; const includes = PluginInclusionUtils . includesContainingDefaultIncludes ( includesFromType , excludesFromType , defaultIncludes ) ; const expectedIncludes = [ 'SomeAlreadyIncludedThang' , 'Another' , 'SomeDefault' , ] ; expect ( includes ) . toEqualJSON ( expectedIncludes ) ; } ) ; it ( 'does not return includes when the only default include is excluded' , function ( ) { const includesFromType = [ ] ; const excludesFromType = [ 'SomeDefault' ] ; const defaultIncludes = List . of < string > ( 'SomeDefault' ) ; const includes = PluginInclusionUtils . includesContainingDefaultIncludes ( includesFromType , excludesFromType , defaultIncludes ) ; const expectedIncludes = [ ] ; expect ( includes ) . toEqualJSON ( expectedIncludes ) ; } ) ; it ( 'returns includes containing only one provided default include when two default ' + 'includes are supplied but one is excluded' , function ( ) { const includesFromType = [ ] ; const excludesFromType = [ 'Another' ] ; const defaultIncludes = List . of < string > ( 'SomeDefault' , 'Another' ) ; const includes = PluginInclusionUtils . includesContainingDefaultIncludes ( includesFromType , excludesFromType , defaultIncludes ) ; const expectedIncludes = [ 'SomeDefault' ] ; expect ( includes ) . toEqualJSON ( expectedIncludes ) ; } ) ; } ) ; } ) ;