react / wstein / node_modules / jest-cli / node_modules / node-haste / __tests__ / getImageSize-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*/17describe("getImageSize", function() {18var path = require('path');19var fs = require('fs');20var root = path.join(__dirname, '..', '__test_data__', 'Image');21var getImageSize = require('../lib/parse/getImageSize');2223it('should parse gif image size', function() {24var buffer = fs.readFileSync(path.join(root, '200x100.gif'));25var size = getImageSize(buffer);26expect(size.width).toBe(200);27expect(size.height).toBe(100);28});2930it('should parse png image size', function() {31var buffer = fs.readFileSync(path.join(root, '200x100.png'));32var size = getImageSize(buffer);33expect(size.width).toBe(200);34expect(size.height).toBe(100);35});3637it('should parse jpeg image size', function() {38var buffer = fs.readFileSync(path.join(root, '200x100.jpg'));39var size = getImageSize(buffer);40expect(size.width).toBe(200);41expect(size.height).toBe(100);42});43});444546