diff --git a/test/testUuid.js b/test/testUuid.js deleted file mode 100644 index 6785954bb..000000000 --- a/test/testUuid.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - Copyright 2008-2013 - Matthias Ehmann, - Michael Gerhaeuser, - Carsten Miller, - Bianca Valentin, - Alfred Wassermann, - Peter Wilfahrt - - This file is part of JSXGraph. - - JSXGraph is free software dual licensed under the GNU LGPL or MIT License. - - You can redistribute it and/or modify it under the terms of the - - * GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version - OR - * MIT License: https://github.com/jsxgraph/jsxgraph/blob/master/LICENSE.MIT - - JSXGraph is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License and - the MIT License along with JSXGraph. If not, see - and . - */ - - -/* - * Js-Test-Driver Test Suite for JXG.Group - * http://code.google.com/p/js-test-driver - */ - -TestCase("UUID", { - setUp: function () { }, - - tearDown: function () { }, - - testCreateGroup: function () { - expectAsserts(1); - - assertEquals('genuuid returns tsring', typeof JXG.Util.genUUID(), 'string'); - } -}); - diff --git a/tests/intern.js b/tests/intern.js index b1633bb78..7d10e8765 100644 --- a/tests/intern.js +++ b/tests/intern.js @@ -62,7 +62,7 @@ define({ //'tests/unit/utils/event', //'tests/unit/utils/expect', 'tests/unit/utils/type', - //'tests/unit/utils/uuid', + 'tests/unit/utils/uuid', //'tests/unit/utils/xml', //'tests/unit/utils/zip', ], diff --git a/tests/unit/utils/uuid.js b/tests/unit/utils/uuid.js new file mode 100644 index 000000000..98a6d6815 --- /dev/null +++ b/tests/unit/utils/uuid.js @@ -0,0 +1,41 @@ +define([ + 'intern!object', + 'intern/chai!assert', + 'utils/uuid' +], function (registerSuite, assert, UUID) { + registerSuite({ + genUUID_NoInput_ReturnsString: function () { + var result; + + result = UUID.genUUID(); + + assert.isString(result); + }, + + genUUID_NoInput_ReturnsOnlyAlphaNumericAndDash: function () { + var result; + + result = UUID.genUUID(); + + assert(/^[a-zA-Z0-9\-]+$/.test(result)); + }, + + genUUID_NoInput_ResultIs36CharsLong: function () { + var expectedLength = 36, + result; + + result = UUID.genUUID(); + + assert.equal(result.length, expectedLength); + }, + + genUUID_TwoCalls_DifferentResults: function () { + var result1, result2; + + result1 = UUID.genUUID(); + result2 = UUID.genUUID(); + + assert.notEqual(result1, result2); + } + }); +});