From 20da9665462ef74b25990bd412469f522c3e14ed Mon Sep 17 00:00:00 2001 From: Christoph Pojer Date: Thu, 2 Mar 2017 05:23:22 -0800 Subject: [PATCH] Bring back polyfill test Reviewed By: jeanlauliac Differential Revision: D4642517 fbshipit-source-id: 0882f453eb91c9f12a9e507ccfa60873106d2d71 --- .../src/Resolver/__tests__/Resolver-test.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/metro-bundler/src/Resolver/__tests__/Resolver-test.js b/packages/metro-bundler/src/Resolver/__tests__/Resolver-test.js index 821282d4..b5daf28f 100644 --- a/packages/metro-bundler/src/Resolver/__tests__/Resolver-test.js +++ b/packages/metro-bundler/src/Resolver/__tests__/Resolver-test.js @@ -131,6 +131,13 @@ describe('Resolver', function() { })); }); + const polyfill = { + id: 'polyfills/Object.es6.js', + file: 'polyfills/Object.es6.js', + dependencies: [], + }; + DependencyGraph.prototype.createPolyfill.mockReturnValueOnce(polyfill); + return depResolver .getDependencies( '/root/index.js', @@ -141,6 +148,11 @@ describe('Resolver', function() { ).then(function(result) { expect(result.mainModuleId).toEqual('index'); expect(result.dependencies[result.dependencies.length - 1]).toBe(module); + + expect(DependencyGraph.mock.instances[0].getDependencies) + .toBeCalledWith({entryPath: '/root/index.js', recursive: true}); + expect(result.dependencies[0]).toEqual(polyfill); + expect( DependencyGraph .prototype