Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-transformer-sharp

Package Overview
Dependencies
Maintainers
1
Versions
569
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-transformer-sharp - npm Package Compare versions

Comparing version 1.0.0-alpha13-alpha.0189ea42 to 1.0.0-alpha13-alpha.215cabc2

73

__tests__/gatsby-node.js

@@ -1,27 +0,52 @@

const Promise = require("bluebird")
"use strict";
const { onNodeCreate } = require("../src/gatsby-node")
var _regenerator = require("babel-runtime/regenerator");
describe(`Process image nodes correctly`, () => {
it(`correctly creates an ImageSharp node from a file image node`, async () => {
const node = {
id: "whatever",
contentDigest: "whatever",
extension: `png`,
children: [],
}
const createNode = jest.fn()
const updateNode = jest.fn()
const boundActionCreators = { createNode, updateNode }
var _regenerator2 = _interopRequireDefault(_regenerator);
await onNodeCreate({
node,
boundActionCreators,
}).then(() => {
expect(createNode.mock.calls).toMatchSnapshot()
expect(updateNode.mock.calls).toMatchSnapshot()
expect(createNode).toHaveBeenCalledTimes(1)
expect(updateNode).toHaveBeenCalledTimes(1)
})
})
})
var _asyncToGenerator2 = require("babel-runtime/helpers/asyncToGenerator");
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var Promise = require(`bluebird`);
var _require = require(`../gatsby-node`),
onNodeCreate = _require.onNodeCreate;
describe(`Process image nodes correctly`, function () {
it(`correctly creates an ImageSharp node from a file image node`, (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee() {
var node, createNode, updateNode, boundActionCreators;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
node = {
id: `whatever`,
contentDigest: `whatever`,
extension: `png`,
children: []
};
createNode = jest.fn();
updateNode = jest.fn();
boundActionCreators = { createNode, updateNode };
_context.next = 6;
return onNodeCreate({
node,
boundActionCreators
}).then(function () {
expect(createNode.mock.calls).toMatchSnapshot();
expect(updateNode.mock.calls).toMatchSnapshot();
expect(createNode).toHaveBeenCalledTimes(1);
expect(updateNode).toHaveBeenCalledTimes(1);
});
case 6:
case "end":
return _context.stop();
}
}
}, _callee, undefined);
})));
});

@@ -21,3 +21,3 @@ "use strict";

createNode = boundActionCreators.createNode, updateNode = boundActionCreators.updateNode;
extensions = ["jpeg", "jpg", "png", "webp", "tif", "tiff", "svg"];
extensions = [`jpeg`, `jpg`, `png`, `webp`, `tif`, `tiff`, `svg`];

@@ -34,4 +34,4 @@ if (_.includes(extensions, node.extension)) {

logical: true,
id: `${ node.id } >> ImageSharp`,
contentDigest: `${ node.id }`,
id: `${node.id} >> ImageSharp`,
contentDigest: `${node.id}`,
parent: node.id,

@@ -65,4 +65,4 @@ type: `ImageSharp`,

var _ = require("lodash");
var _ = require(`lodash`);
exports.onNodeCreate = onNodeCreate;
{
"name": "gatsby-transformer-sharp",
"version": "1.0.0-alpha13-alpha.0189ea42",
"version": "1.0.0-alpha13-alpha.215cabc2",
"description": "Gatsby transformer plugin for images using Sharp",

@@ -18,8 +18,8 @@ "scripts": {

"dependencies": {
"bluebird": "^3.4.6",
"bluebird": "^3.5.0",
"unist-util-select": "^1.5.0"
},
"devDependencies": {
"babel-cli": "^6.18.0"
"babel-cli": "^6.24.1"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc