react / wstein / node_modules / jest-cli / node_modules / node-haste / __tests__ / ProjectConfiguration-test.js
80668 views/**1* Copyright 2013 Facebook, Inc.2*3* Licensed under the Apache License, Version 2.0 (the "License");4* you may not use this file except in compliance with the License.5* You may obtain a copy of the License at6*7* http://www.apache.org/licenses/LICENSE-2.08*9* Unless required by applicable law or agreed to in writing, software10* distributed under the License is distributed on an "AS IS" BASIS,11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12* See the License for the specific language governing permissions and13* limitations under the License.14*15* @emails [email protected] [email protected]16*/1718describe('ProjectConfiguration', function() {19var path = require('path');20var ProjectConfiguration = require('../lib/resource/ProjectConfiguration');2122it('should return non-haste affecteded roots', function() {23var resource = new ProjectConfiguration('a/b/package.json', {});24expect(resource.getHasteRoots()).toEqual([path.join('a','b')]);25});2627it('should return haste affecteded roots', function() {28var resource = new ProjectConfiguration(29'a/b/package.json',30{ haste: {31roots: ['lib', 'tests']32}});33expect(resource.getHasteRoots()).toEqual([path.join('a','b','lib'), path.join('a','b','tests')]);34});3536it('should resolve id with a prefix', function() {37var resource = new ProjectConfiguration(38'a/b/package.json',39{ haste: {40roots: ['lib', 'tests'],41prefix: "bar"42}});43expect(resource.resolveID(path.join('a','b','lib','foo'))).toEqual(path.join('bar','foo'));44});4546it('should resolve id without a prefix', function() {47var resource = new ProjectConfiguration(48'a/b/package.json',49{ haste: {50roots: ['lib', 'tests'],51prefix: ""52}});53expect(resource.resolveID(path.join('a','b','lib','foo'))).toEqual('foo');54});5556});575859