mirror of
https://github.com/azures04/crafatar.git
synced 2026-03-22 07:51:17 +01:00
tests: dashed uuid should be valid
This commit is contained in:
parent
3216833887
commit
05d7547a07
30
test/test.js
30
test/test.js
@ -30,10 +30,6 @@ describe('UUID/username', function() {
|
|||||||
assert.strictEqual(helpers.uuid_valid(""), false);
|
assert.strictEqual(helpers.uuid_valid(""), false);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
it("should be an invalid uuid", function(done) {
|
|
||||||
assert.strictEqual(helpers.uuid_valid("0098cb60-fa8e-427c-b299-793cbd302c9a"), false);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
it("should be an invalid username", function(done) {
|
it("should be an invalid username", function(done) {
|
||||||
assert.strictEqual(helpers.uuid_valid("usernäme"), false);
|
assert.strictEqual(helpers.uuid_valid("usernäme"), false);
|
||||||
done();
|
done();
|
||||||
@ -50,10 +46,18 @@ describe('UUID/username', function() {
|
|||||||
assert.strictEqual(helpers.uuid_valid("0098cb60fa8e427cb299793cbd302c9a"), true);
|
assert.strictEqual(helpers.uuid_valid("0098cb60fa8e427cb299793cbd302c9a"), true);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
it("should be a valid uuid", function(done) {
|
||||||
|
assert.strictEqual(helpers.uuid_valid("0098cb60-fa8e-427c-b299-793cbd302c9a"), true);
|
||||||
|
done();
|
||||||
|
});
|
||||||
it("should be a valid username", function(done) {
|
it("should be a valid username", function(done) {
|
||||||
assert.strictEqual(helpers.uuid_valid("__niceUs3rname__"), true);
|
assert.strictEqual(helpers.uuid_valid("__niceUs3rname__"), true);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
it("should be a valid username", function(done) {
|
||||||
|
assert.strictEqual(helpers.uuid_valid("a"), true);
|
||||||
|
done();
|
||||||
|
});
|
||||||
it("should not exist", function(done) {
|
it("should not exist", function(done) {
|
||||||
networking.get_profile("00000000000000000000000000000000", function(err, profile) {
|
networking.get_profile("00000000000000000000000000000000", function(err, profile) {
|
||||||
assert.strictEqual(err, 0);
|
assert.strictEqual(err, 0);
|
||||||
@ -75,6 +79,15 @@ describe('UUID/username', function() {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
it("should be checked (uuid)", function(done) {
|
||||||
|
var original_cache_time = config.local_cache_time;
|
||||||
|
config.local_cache_time = 0;
|
||||||
|
helpers.get_avatar(uuid, false, 160, function(err, status, image) {
|
||||||
|
assert.strictEqual(status, 2);
|
||||||
|
config.local_cache_time = original_cache_time;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
it("should be downloaded (username)", function(done) {
|
it("should be downloaded (username)", function(done) {
|
||||||
helpers.get_avatar(username, false, 160, function(err, status, image) {
|
helpers.get_avatar(username, false, 160, function(err, status, image) {
|
||||||
assert.strictEqual(status, 2);
|
assert.strictEqual(status, 2);
|
||||||
@ -87,6 +100,15 @@ describe('UUID/username', function() {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
it("should be checked (username)", function(done) {
|
||||||
|
var original_cache_time = config.local_cache_time;
|
||||||
|
config.local_cache_time = 0;
|
||||||
|
helpers.get_avatar(username, false, 160, function(err, status, image) {
|
||||||
|
assert.strictEqual(status, 2);
|
||||||
|
config.local_cache_time = original_cache_time;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
it("should not exist (but account does)", function(done) {
|
it("should not exist (but account does)", function(done) {
|
||||||
// profile 'Alex'
|
// profile 'Alex'
|
||||||
helpers.get_avatar("ec561538f3fd461daff5086b22154bce", false, 160, function(err, status, image) {
|
helpers.get_avatar("ec561538f3fd461daff5086b22154bce", false, 160, function(err, status, image) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user