diff --git a/package-lock.json b/package-lock.json index 4a0b6d0..7a3c6e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,8 +12,6 @@ "@types/jest": "^29.5.0", "@types/node": "^18.15.11", "jest": "^29.5.0", - "mocha": "^1.21.4", - "should": "^4.0.4", "ts-jest": "^29.1.0", "typescript": "^5.0.4" } @@ -1532,15 +1530,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/commander": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.3.0.tgz", - "integrity": "sha512-CD452fnk0jQyk3NfnK+KkR/hUPoHt5pVaKHogtyyv3N0U4QfAal9W0/rXLOg/vVZgQKa7jdtXypKs1YAip11uQ==", - "dev": true, - "engines": { - "node": ">= 0.6.x" - } - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -1608,15 +1597,6 @@ "node": ">=8" } }, - "node_modules/diff": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/diff/-/diff-1.0.8.tgz", - "integrity": "sha512-1zEb73vemXFpUmfh3fsta4YHz3lwebxXvaWmPbFv9apujQBWDnkrPDLXLQs1gZo4RCWMDsT89r0Pf/z8/02TGA==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, "node_modules/diff-sequences": { "version": "29.4.3", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.4.3.tgz", @@ -1668,15 +1648,6 @@ "node": ">=6" } }, - "node_modules/escape-string-regexp": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.2.tgz", - "integrity": "sha512-cQpUid7bdTUnFin8S7BnNdOk+/eDqQmKgCANSyd/jAhrKEvxUvr9VQ8XZzXiOtest8NLfk3FSBZzwvemZNQ6Vg==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -1843,20 +1814,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/glob": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.3.tgz", - "integrity": "sha512-WPaLsMHD1lYEqAmIQI6VOJSPwuBdGShDWnj1yUo0vQqEO809R8W3LM9OVU13CnnDhyv/EiNwOtxEW74SmrzS6w==", - "dev": true, - "dependencies": { - "graceful-fs": "~2.0.0", - "inherits": "2", - "minimatch": "~0.2.11" - }, - "engines": { - "node": "*" - } - }, "node_modules/globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", @@ -1866,22 +1823,6 @@ "node": ">=4" } }, - "node_modules/graceful-fs": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-2.0.3.tgz", - "integrity": "sha512-hcj/NTUWv+C3MbqrVb9F+aH6lvTwEHJdx2foBxlrVq5h6zE8Bfu4pv4CAAqbDcZrw/9Ak5lsRXlY9Ao8/F0Tuw==", - "deprecated": "please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/growl": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.8.1.tgz", - "integrity": "sha512-Hq61svqhXHBTY80KsuLrItJ9A0YP1PSeiS4hhi77NcPQf+F+yagOSkhuhZdND7NfAcpHm495FKUTmRcygzF0OA==", - "dev": true - }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -2091,39 +2032,6 @@ "node": ">=8" } }, - "node_modules/jade": { - "version": "0.26.3", - "resolved": "https://registry.npmjs.org/jade/-/jade-0.26.3.tgz", - "integrity": "sha512-mkk3vzUHFjzKjpCXeu+IjXeZD+QOTjUUdubgmHtHTDwvAO2ZTkMTTVrapts5CWz3JvJryh/4KWZpjeZrCepZ3A==", - "deprecated": "Jade has been renamed to pug, please install the latest version of pug instead of jade", - "dev": true, - "dependencies": { - "commander": "0.6.1", - "mkdirp": "0.3.0" - }, - "bin": { - "jade": "bin/jade" - } - }, - "node_modules/jade/node_modules/commander": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-0.6.1.tgz", - "integrity": "sha512-0fLycpl1UMTGX257hRsu/arL/cUbcvQM4zMKwvLvzXtfdezIV4yotPS2dYtknF+NmEfWSoCEF6+hj9XLm/6hEw==", - "dev": true, - "engines": { - "node": ">= 0.4.x" - } - }, - "node_modules/jade/node_modules/mkdirp": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz", - "integrity": "sha512-OHsdUcVAQ6pOtg5JYWpCBo9W/GySVuwvP9hueRMW7UqshC0tbfzLv8wjySTPm3tfUZ/21CE9E1pJagOA91Pxew==", - "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/jest": { "version": "29.5.0", "resolved": "https://registry.npmjs.org/jest/-/jest-29.5.0.tgz", @@ -2924,12 +2832,6 @@ "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", "dev": true }, - "node_modules/lru-cache": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", - "integrity": "sha512-WpibWJ60c3AgAz8a2iYErDrcT2C7OmKnsWhIcHOjkUHFjkXncJhtLxNSqUmxRxRunpb5I8Vprd7aNSd2NtksJQ==", - "dev": true - }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -2988,78 +2890,6 @@ "node": ">=6" } }, - "node_modules/minimatch": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", - "integrity": "sha512-zZ+Jy8lVWlvqqeM8iZB7w7KmQkoJn8djM585z88rywrEbzoqawVa9FR5p2hwD+y74nfuKOjmNvi9gtWJNLqHvA==", - "deprecated": "Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue", - "dev": true, - "dependencies": { - "lru-cache": "2", - "sigmund": "~1.0.0" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha512-miQKw5Hv4NS1Psg2517mV4e4dYNaO3++hjAvLOAzKqZ61rH8NS1SK+vbfBWZ5PY/Me/bEWhUwqMghEW5Fb9T7Q==", - "dev": true - }, - "node_modules/mkdirp": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz", - "integrity": "sha512-xjjNGy+ry1lhtIKcr2PT6ok3aszhQfgrUDp4OZLHacgRgFmF6XR9XCOJVcXlVGQonIqXcK1DvqgKKQOPWYGSfw==", - "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", - "dev": true, - "dependencies": { - "minimist": "0.0.8" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/mocha": { - "version": "1.21.5", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-1.21.5.tgz", - "integrity": "sha512-ng2r0YrLCHtmp8W7HyLzSmbdidt3g1I63HhCmOqZH4vzFhmtHcYwcoAmpsJKL142He9NA2HJpmsz9amYDxoZ1Q==", - "deprecated": "Mocha v1.x is no longer supported.", - "dev": true, - "dependencies": { - "commander": "2.3.0", - "debug": "2.0.0", - "diff": "1.0.8", - "escape-string-regexp": "1.0.2", - "glob": "3.2.3", - "growl": "1.8.1", - "jade": "0.26.3", - "mkdirp": "0.5.0" - }, - "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha" - }, - "engines": { - "node": ">= 0.4.x" - } - }, - "node_modules/mocha/node_modules/debug": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.0.0.tgz", - "integrity": "sha512-jRxFR0Fb657ikmm6IjHY32v/Nqp9Ndcx4LBISXPfpguNaHh5JJnb+x37qalKPTu4fxMFnVBIyEGi72mmvl0BCw==", - "dev": true, - "dependencies": { - "ms": "0.6.2" - } - }, - "node_modules/mocha/node_modules/ms": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.6.2.tgz", - "integrity": "sha512-/pc3eh7TWorTtbvXg8je4GvrvEqCfH7PA3P7iW01yL2E53FKixzgMBaQi0NOPbMJqY34cBSvR0tZtmlTkdUG4A==", - "dev": true - }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -3417,47 +3247,6 @@ "node": ">=8" } }, - "node_modules/should": { - "version": "4.6.5", - "resolved": "https://registry.npmjs.org/should/-/should-4.6.5.tgz", - "integrity": "sha512-k6+QDvVxph/xH9mVAEZjFF5iw0G17x59PiiRxdMvWMFuj0+gXlKdDMzODBlbsIyzfLk/2XigJlaI6qj1hFMlHg==", - "dev": true, - "dependencies": { - "should-equal": "0.3.1", - "should-format": "0.0.7", - "should-type": "0.0.4" - } - }, - "node_modules/should-equal": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-0.3.1.tgz", - "integrity": "sha512-/Q/o9EL9CJlCsy817ZkcQVlyUzyeWUxS9HkXUrqv4tTg+aOXEwvOpR1odT0K9DwcMA0gCy452K71YJA1E6K1mQ==", - "dev": true, - "dependencies": { - "should-type": "0.0.4" - } - }, - "node_modules/should-format": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/should-format/-/should-format-0.0.7.tgz", - "integrity": "sha512-8oNurKotJEQy+HboLxAHkgKQ+dRfV9TmVAvcY3He1RdnE994M39JTmkCt67cWaygVLKUfBcLRITkpHy2Hsgwcg==", - "dev": true, - "dependencies": { - "should-type": "0.0.4" - } - }, - "node_modules/should-type": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/should-type/-/should-type-0.0.4.tgz", - "integrity": "sha512-ve9tkv/i29COtupPlu2g4SXGefgSTjDTBI8d5UgSmT52T9T5VBpZY9/Ygn5Pb3dcCaiMyEzBAxBkpUGxEbbMDw==", - "dev": true - }, - "node_modules/sigmund": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", - "integrity": "sha512-fCvEXfh6NWpm+YSuY2bpXb/VIihqWA6hLsgboC+0nl71Q7N7o2eaCW8mJa/NLvQhs6jpd3VZV4UiUQlV6+lc8g==", - "dev": true - }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", diff --git a/package.json b/package.json index 1116e18..1031de2 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,6 @@ "@types/jest": "^29.5.0", "@types/node": "^18.15.11", "jest": "^29.5.0", - "mocha": "^1.21.4", - "should": "^4.0.4", "ts-jest": "^29.1.0", "typescript": "^5.0.4" } diff --git a/test/parse_spec.js b/test/parse_spec.js deleted file mode 100644 index 0046fab..0000000 --- a/test/parse_spec.js +++ /dev/null @@ -1,75 +0,0 @@ -'use strict'; -var fs = require('fs'); -var path = require('path'); -var should = require('should'); -var wowtoc = require('../lib'); - -describe('wow-toc.parse', function() { - it ('should work on a basic file', function () { - var fixture = fs.readFileSync(path.join(__dirname, 'fixtures', 'basic-file.toc'), { encoding: 'utf8' }); - wowtoc.parse(fixture).should.eql({ - tags: { - 'Interface': '50400', - 'Title': 'Waiting for Godot', - 'Notes': '"Nothing to be done."', - 'Version': '4.2' - }, - files: [ - 'Vladimir.xml', - 'Estragon.lua' - ] - }); - }); - it ('should trunicate lines over 1024', function() { - var fixture = fs.readFileSync(path.join(__dirname, 'fixtures', 'trunicate.toc'), { encoding: 'utf8' }); - wowtoc.parse(fixture).tags['X-Long'].should.equal('d'.repeat(1024-11)); - }); - it ('should correctly parse Recount.toc', function() { - /** - * Recount was selected because it's well known has a fairly large toc, - * and it has non-latin characters in some translations. - * I can't find any data on the Recount license, so I'm attributing it - * and leaving it unmodified in test/fixtures/Recount.toc - */ - var fixture = fs.readFileSync(path.join(__dirname, 'fixtures', 'Recount.toc'), { encoding: 'utf8' }); - var correct = fs.readFileSync(path.join(__dirname, 'fixtures', 'Recount.json'), { encoding: 'utf8' }); - wowtoc.parse(fixture).should.eql(JSON.parse(correct)); - }); -}); - -//polyfill from MDN -if (!String.prototype.repeat) { - // jshint ignore:start - String.prototype.repeat = function (count) { - "use strict"; - if (this == null) - throw new TypeError("can't convert " + this + " to object"); - var str = "" + this; - count = +count; - if (count != count) - count = 0; - if (count < 0) - throw new RangeError("repeat count must be non-negative"); - if (count == Infinity) - throw new RangeError("repeat count must be less than infinity"); - count = Math.floor(count); - if (str.length == 0 || count == 0) - return ""; - // Ensuring count is a 31-bit integer allows us to heavily optimize the - // main part. But anyway, most current (august 2014) browsers can't handle - // strings 1 << 28 chars or longer, so : - if (str.length * count >= 1 << 28) - throw new RangeError("repeat count must not overflow maximum string size"); - var rpt = ""; - for (;;) { - if ((count & 1) == 1) - rpt += str; - count >>>= 1; - if (count == 0) - break; - str += str; - } - return rpt; - } - // jshint ignore:end -} \ No newline at end of file diff --git a/test/stringify_spec.js b/test/stringify_spec.js deleted file mode 100644 index 2fcfb0c..0000000 --- a/test/stringify_spec.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; -var fs = require('fs'); -var path = require('path'); -var should = require('should'); -var wowtoc = require('../lib'); - -describe('wow-toc.stringify', function() { - it ('should work with basic data', function() { - var fixture = fs.readFileSync(path.join(__dirname, 'fixtures', 'basic-output.toc'), { encoding: 'utf8' }); - wowtoc.stringify({ - tags: { - 'Title': 'Bacon', - 'Interface': '50400', - 'Notes': 'I hate everyone', - 'Version': '4.3.2.1' - }, - files: ['load.xml', 'bacon.lua'] - }).should.equal(fixture); - }); -}); \ No newline at end of file