diff --git a/packages/metro/src/shared/output/__tests__/__snapshots__/meta-test.js.snap b/packages/metro/src/shared/output/__tests__/__snapshots__/meta-test.js.snap new file mode 100644 index 00000000..c3b4bad2 --- /dev/null +++ b/packages/metro/src/shared/output/__tests__/__snapshots__/meta-test.js.snap @@ -0,0 +1,30 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`exports the blacklist creator 1`] = ` +Object { + "data": Array [ + 56, + 131, + 13, + 89, + 254, + 63, + 108, + 210, + 213, + 112, + 53, + 173, + 11, + 21, + 31, + 184, + 133, + 221, + 114, + 86, + 1, + ], + "type": "Buffer", +} +`; diff --git a/packages/metro/src/shared/output/__tests__/meta-test.js b/packages/metro/src/shared/output/__tests__/meta-test.js new file mode 100644 index 00000000..4ddbbc1b --- /dev/null +++ b/packages/metro/src/shared/output/__tests__/meta-test.js @@ -0,0 +1,18 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @format + * @emails oncall+js_foundation + */ +'use strict'; + +const meta = require('../meta'); + +it('exports the blacklist creator', () => { + expect(meta('some formatted code', 'utf8')).toMatchSnapshot(); +}); diff --git a/packages/metro/src/shared/output/meta.js b/packages/metro/src/shared/output/meta.js index 7a2426ac..5fc611ab 100644 --- a/packages/metro/src/shared/output/meta.js +++ b/packages/metro/src/shared/output/meta.js @@ -31,7 +31,7 @@ module.exports = function( const buffer: Buffer = asBuffer(code, encoding); const hash = crypto.createHash('sha1'); hash.update(buffer); - const digest = hash.digest('buffer'); + const digest = hash.digest(); const signature = Buffer.alloc ? Buffer.alloc(digest.length + 1) : new Buffer(digest.length + 1);