[react-packager][streamline oss] Move open sourced JS source to react-native-github

This commit is contained in:
Spencer Ahrens
2015-02-19 20:10:52 -08:00
commit efae175a8e
434 changed files with 44658 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
"use strict";
jest.autoMockOff();
describe('isExportsOrModuleAssignment', function() {
var recast;
var isExportsOrModuleAssignment;
function parse(src) {
return new recast.types.NodePath(
recast.parse(src).program.body[0]
);
}
beforeEach(function() {
isExportsOrModuleAssignment = require('../isExportsOrModuleAssignment');
recast = require('recast');
});
it('detects "module.exports = ...;"', function() {
expect(isExportsOrModuleAssignment(parse('module.exports = foo;')))
.toBe(true);
});
it('detects "exports.foo = ..."', function() {
expect(isExportsOrModuleAssignment(parse('exports.foo = foo;')))
.toBe(true);
});
it('does not accept "exports = foo;"', function() {
// That doesn't actually export anything
expect(isExportsOrModuleAssignment(parse('exports = foo;')))
.toBe(false);
});
});