Commit c9588ad5 authored by Sam Saccone's avatar Sam Saccone

Add the first test

Implemented a basic test around exporting a png.
More can follow but at least something to build off of.
parent 97c9d86a
language: node_js
node_js:
- "0.11"
- "0.10"
- "0.8"
\ No newline at end of file
...@@ -9,8 +9,12 @@ ...@@ -9,8 +9,12 @@
"rsvp": "~ 3.0.6", "rsvp": "~ 3.0.6",
"lodash": "~ 2.4" "lodash": "~ 2.4"
}, },
"test": "mocha test",
"devDependencies": { "devDependencies": {
"coffeeify": "~ 0.6.0", "coffeeify": "~ 0.6.0",
"browserify": "~ 3.46.0" "browserify": "~ 3.46.0",
"mocha": "~ 1.18.2",
"should": "~ 3.3.1",
"rimraf": "~ 2.2.8"
} }
} }
--reporter spec
--compilers coffee:coffee-script/register
\ No newline at end of file
PSD = require '../'
fs = require 'fs'
rimraf = require 'rimraf'
path = require 'path'
should = require 'should'
outputPath = path.resolve(__dirname, "output")
fixturesPath = path.resolve(__dirname, "fixtures")
describe "exporting from a PSD", ->
beforeEach (done) ->
fs.mkdir outputPath, done
afterEach (done) ->
rimraf outputPath, done
it "should export a png", (done) ->
psdPath = path.resolve(__dirname, "../", "examples/images/example.psd")
filePath = path.join(outputPath, "out.png")
expectedPath = path.join(fixturesPath, "out.png")
PSD.open(psdPath)
.then (psd) ->
psd.image.saveAsPng filePath
.then ->
fs.statSync(filePath).size
.should
.eql(fs.statSync(expectedPath).size)
.then -> done()
.catch done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment