mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #302 from hbeeken/fix-ui-windows-test-failure
Removing assumption that /tmp exists so test runs on Windows
This commit is contained in:
commit
3d31a0abca
@ -47,24 +47,27 @@ describe("red/ui icon handler", function() {
|
||||
});
|
||||
|
||||
describe("icon cache handler", function() {
|
||||
var fs = require("fs");
|
||||
var fs = require('fs-extra');
|
||||
var path = require('path');
|
||||
var events = require("../../red/events");
|
||||
|
||||
var tempDir = "/tmp/";
|
||||
var tempDir = path.join(__dirname,".tmp/");
|
||||
var cachedFakePNG = tempDir + "cacheMe.png";
|
||||
|
||||
|
||||
beforeEach(function(done) {
|
||||
fs.remove(tempDir,function(err) {
|
||||
fs.mkdirSync(tempDir);
|
||||
fs.writeFileSync(cachedFakePNG, "Hello PNG\n");
|
||||
done();
|
||||
});
|
||||
});
|
||||
afterEach(function(done) {
|
||||
fs.exists(cachedFakePNG, function(exists) {
|
||||
if(exists) {
|
||||
fs.unlinkSync(cachedFakePNG);
|
||||
done();
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
fs.remove(tempDir,done);
|
||||
})
|
||||
});
|
||||
|
||||
@ -80,7 +83,7 @@ describe("icon cache handler", function() {
|
||||
*/
|
||||
it('returns an icon using icon cache', function(done) {
|
||||
var app = require("../../red/ui")();
|
||||
events.emit("node-icon-dir", "/tmp/");
|
||||
events.emit("node-icon-dir", tempDir);
|
||||
request(app)
|
||||
.get("/icons/cacheMe.png")
|
||||
.expect('Content-Type', /image\/png/)
|
||||
|
Loading…
Reference in New Issue
Block a user