public void MergeShimsWithSameKey() { var jqueryShim = new ShimEntry { For = "jquery", Dependencies = new List <RequireDependency> { new RequireDependency { Dependency = "depA" }, new RequireDependency { Dependency = "depB" } } }; var altJqueryShim = new ShimEntry { For = "jquery", Dependencies = new List <RequireDependency> { new RequireDependency { Dependency = "depB" }, new RequireDependency { Dependency = "depD" } } }; var firstCollection = ConfigurationCreators.CreateCollectionWithShims(jqueryShim); var secondCollection = ConfigurationCreators.CreateCollectionWithShims(altJqueryShim); var merger = ConfigurationCreators.CreateDefaultConfigMerger(firstCollection, secondCollection); var merged = merger.GetMerged(); var expectedShim = new ShimEntry { For = "jquery", Dependencies = new List <RequireDependency> { new RequireDependency { Dependency = "depA" }, new RequireDependency { Dependency = "depB" }, new RequireDependency { Dependency = "depD" } } }; var expected = ConfigurationCreators.CreateCollectionWithShims(expectedShim); CustomAssert.JsonEquals(expected, merged); }
public void ReadShimWithExports() { var config = ReadJson(new TestFileReader()); var shim = new ShimEntry { For = "jquery-validate", Dependencies = new List <RequireDependency> { new RequireDependency { Dependency = "jquery" } }, Exports = "jqVal" }; var expected = ConfigurationCreators.CreateCollectionWithShims(shim); CustomAssert.JsonEquals(expected, config); }
public void OverrideExportsValueForShimsWithSameKey() { var jqueryShim = new ShimEntry { For = "jquery", Dependencies = new List <RequireDependency>(), Exports = "jqu" }; var altJqueryShim = new ShimEntry { For = "jquery", Dependencies = new List <RequireDependency>(), Exports = "jlo" }; var firstCollection = ConfigurationCreators.CreateCollectionWithShims(jqueryShim); var secondCollection = ConfigurationCreators.CreateCollectionWithShims(altJqueryShim); var merger = ConfigurationCreators.CreateDefaultConfigMerger(firstCollection, secondCollection); var merged = merger.GetMerged(); Assert.Equal("jlo", merged.Shim.ShimEntries.FirstOrDefault().Exports); }