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,6 +125,7 @@ describe('Crafatar', function() {
}); });
}); });
it("should already have the files / not download", function(done) { it("should already have the files / not download", function(done) {
assert.doesNotThrow(function() {
fs.openSync("face.png", "w"); fs.openSync("face.png", "w");
fs.openSync("helm.png", "w"); fs.openSync("helm.png", "w");
networking.skin_file("http://textures.minecraft.net/texture/477be35554684c28bdeee4cf11c591d3c88afb77e0b98da893fd7bc318c65184", "face.png", "helm.png", function(err) { networking.skin_file("http://textures.minecraft.net/texture/477be35554684c28bdeee4cf11c591d3c88afb77e0b98da893fd7bc318c65184", "face.png", "helm.png", function(err) {
@ -134,6 +135,7 @@ describe('Crafatar', function() {
done(); done();
}); });
}); });
});
it("should default to Alex", function(done) { it("should default to Alex", function(done) {
assert.strictEqual(skins.default_skin("ec561538f3fd461daff5086b22154bce"), "alex"); assert.strictEqual(skins.default_skin("ec561538f3fd461daff5086b22154bce"), "alex");
done(); done();
@ -182,11 +184,13 @@ describe('Crafatar', function() {
}); });
}); });
it("should not find the skin", function(done) { it("should not find the skin", function(done) {
assert.doesNotThrow(function() {
networking.skin_file("http://textures.minecraft.net/texture/this-does-not-exist", "face.png", "helm.png", function(err) { networking.skin_file("http://textures.minecraft.net/texture/this-does-not-exist", "face.png", "helm.png", function(err) {
assert.strictEqual(err, null); // no error here, but it shouldn't throw exceptions assert.strictEqual(err, null); // no error here, but it shouldn't throw exceptions
done(); done();
}); });
}); });
});
it("should handle file updates on invalid files", function(done) { it("should handle file updates on invalid files", function(done) {
assert.doesNotThrow(function() { assert.doesNotThrow(function() {
cache.update_timestamp("0123456789abcdef0123456789abcdef", "invalid-file.png"); cache.update_timestamp("0123456789abcdef0123456789abcdef", "invalid-file.png");