@Test public void hasBranchingDisabledTests_withDefinedFeature() throws Exception { mockAggregator.getOptions().setOption(IOptions.DISABLE_HASPLUGINBRANCHING, true); DependencyList depList = new DependencyList("test", new HashSet<String>(), mockAggregator, features, true, false); features.put("test", true); depList.processDep( "dojo/has!test?foo/test:bar/test", explicitDeps, null, new HashSet<String>(), null); assertEquals(2, explicitDeps.size()); assertEquals( new HashSet<String>(Arrays.asList(new String[] {"dojo/has", "foo/test"})), explicitDeps.getModuleIds()); assertEquals( new HashSet<String>(Arrays.asList(new String[] {"test"})), depList.getDependentFeatures()); }
@Before public void setup() throws Exception { tmpDir = Files.createTempDir().toURI(); configRef = new Ref<IConfig>(null); mockAggregator = TestUtils.createMockAggregator(configRef, null); mockDependencies = createMock(IDependencies.class); expect(mockDependencies.getLastModified()).andReturn(0L).anyTimes(); expect(mockDependencies.getDelcaredDependencies("require")) .andReturn(Collections.<String>emptyList()) .anyTimes(); expect(mockAggregator.getDependencies()).andReturn(mockDependencies).anyTimes(); replay(mockAggregator, mockDependencies); configRef.set(new ConfigImpl(mockAggregator, tmpDir, "{}")); features = new Features(); explicitDeps = new ModuleDeps(); }
@Test public void resolveAliasesDisabledAndHasBranchingDisabled_withDefinedFeatures() throws Exception { mockAggregator.getOptions().setOption(IOptions.DISABLE_HASPLUGINBRANCHING, true); configRef.set(new ConfigImpl(mockAggregator, tmpDir, "{aliases:[['foo1/test', 'bar/test']]}")); DependencyList depList = new DependencyList("test", new HashSet<String>(), mockAggregator, features, false, false); features.put("test", true); features.put("test1", true); depList.processDep( "dojo/has!test?test1?foo1/test:bar1/test:test2:foo2/test:bar2/test", explicitDeps, null, new HashSet<String>(), null); assertEquals(2, explicitDeps.size()); assertEquals( new HashSet<String>(Arrays.asList(new String[] {"dojo/has", "foo1/test"})), explicitDeps.getModuleIds()); assertEquals( new HashSet<String>(Arrays.asList(new String[] {"test", "test1"})), depList.getDependentFeatures()); }