test improvements, fix #14

This commit is contained in:
jomo 2014-11-23 22:41:27 +01:00
parent 8ee862596b
commit ea3f322c73

View File

@ -125,13 +125,15 @@ describe('Crafatar', function() {
}); });
}); });
it("should already have the files / not download", function(done) { it("should already have the files / not download", function(done) {
fs.openSync("face.png", "w"); assert.doesNotThrow(function() {
fs.openSync("helm.png", "w"); fs.openSync("face.png", "w");
networking.skin_file("http://textures.minecraft.net/texture/477be35554684c28bdeee4cf11c591d3c88afb77e0b98da893fd7bc318c65184", "face.png", "helm.png", function(err) { fs.openSync("helm.png", "w");
assert.strictEqual(err, null); // no error here, but it shouldn't throw exceptions networking.skin_file("http://textures.minecraft.net/texture/477be35554684c28bdeee4cf11c591d3c88afb77e0b98da893fd7bc318c65184", "face.png", "helm.png", function(err) {
fs.unlinkSync("face.png"); assert.strictEqual(err, null); // no error here, but it shouldn't throw exceptions
fs.unlinkSync("helm.png"); fs.unlinkSync("face.png");
done(); fs.unlinkSync("helm.png");
done();
});
}); });
}); });
it("should default to Alex", function(done) { it("should default to Alex", function(done) {
@ -182,9 +184,11 @@ describe('Crafatar', function() {
}); });
}); });
it("should not find the skin", function(done) { it("should not find the skin", function(done) {
networking.skin_file("http://textures.minecraft.net/texture/this-does-not-exist", "face.png", "helm.png", function(err) { assert.doesNotThrow(function() {
assert.strictEqual(err, null); // no error here, but it shouldn't throw exceptions networking.skin_file("http://textures.minecraft.net/texture/this-does-not-exist", "face.png", "helm.png", function(err) {
done(); assert.strictEqual(err, null); // no error here, but it shouldn't throw exceptions
done();
});
}); });
}); });
it("should handle file updates on invalid files", function(done) { it("should handle file updates on invalid files", function(done) {