react / wstein / node_modules / jest-cli / node_modules / node-haste / __tests__ / JSTestLoader-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('JSTestLoader', function() {19var JSTestLoader = require('../lib/loader/JSTestLoader');20var path = require('path');21var loadResouce = require('../lib/test_helpers/loadResource');2223it('should match package.json paths', function() {24var loader = new JSTestLoader();25expect(loader.matchPath('x.js')).toBe(false);26expect(loader.matchPath('a/__tests__/x.js')).toBe(true);27expect(loader.matchPath('__tests__/x.js')).toBe(true);28expect(loader.matchPath('a/__tests__/support/x.js')).toBe(false);29expect(loader.matchPath('a/1.css')).toBe(false);30});3132var testData = path.join(__dirname, '..', '__test_data__', 'JSTest');3334it('should extract dependencies', function() {35loadResouce(36new JSTestLoader(),37path.join(testData, '__tests__', 'test-test.js'),38null,39function(errors, resource) {40expect(resource.id).toBe('test-test');41expect(resource.requiredModules)42.toEqual(['fs', 'temp', 'mock-modules']);43expect(resource.contacts)44.toEqual(['[email protected]', '[email protected]']);45});46});4748});495051