[Pkg-javascript-commits] [node-compressible] 02/13: Imported Upstream version 2.0.1

Leo Iannacone l3on-guest at moszumanska.debian.org
Sat Oct 11 12:41:43 UTC 2014


This is an automated email from the git hooks/post-receive script.

l3on-guest pushed a commit to branch master
in repository node-compressible.

commit 76f62e9d983a6dcb35246dc34fdded850ab98bb5
Author: Leo Iannacone <l3on at ubuntu.com>
Date:   Fri Oct 10 12:13:58 2014 +0200

    Imported Upstream version 2.0.1
---
 .npmignore           |   9 -
 .travis.yml          |  14 +-
 HISTORY.md           |  17 ++
 README.md => LICENSE |  38 +----
 README.md            |  63 +++----
 index.js             |  51 +++---
 package.json         |  42 +++--
 specifications.json  | 473 ---------------------------------------------------
 test/test.js         |  67 +++-----
 9 files changed, 124 insertions(+), 650 deletions(-)

diff --git a/.npmignore b/.npmignore
deleted file mode 100644
index f8b959f..0000000
--- a/.npmignore
+++ /dev/null
@@ -1,9 +0,0 @@
-test
-.travis.yml
-
-npm-debug.log
-
-# Sublime Text #
-##############
-*.sublime-project
-*.sublime-workspace
diff --git a/.travis.yml b/.travis.yml
index 65cf4bc..762b977 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,9 +1,7 @@
-language: node_js
 node_js:
-  - "0.8"
-  - "0.10"
-  - "0.11"
-matrix:
-  allow_failures:
-    - node_js: "0.11"
-  fast_finish: true
+- "0.8"
+- "0.10"
+- "0.11"
+language: node_js
+script: "npm run-script test-travis"
+after_script: "npm install coveralls at 2 && cat ./coverage/lcov.info | coveralls"
diff --git a/HISTORY.md b/HISTORY.md
new file mode 100644
index 0000000..3b11ac5
--- /dev/null
+++ b/HISTORY.md
@@ -0,0 +1,17 @@
+2.0.1 / 2014-09-28
+==================
+
+  * deps: mime-db at 1.x
+    - Add new mime types
+    - Add additional compressible
+    - Update charsets
+
+
+2.0.0 / 2014-09-02
+==================
+
+  * use mime-db
+  * remove .get()
+  * specifications are now private
+  * regex is now private
+  * stricter regex
diff --git a/README.md b/LICENSE
similarity index 54%
copy from README.md
copy to LICENSE
index 7df7ab0..cef03ed 100644
--- a/README.md
+++ b/LICENSE
@@ -1,43 +1,7 @@
-# compressible
-
-[![Build Status](https://travis-ci.org/expressjs/compressible.svg?branch=master)](https://travis-ci.org/expressjs/compressible)
-[![NPM Version](https://badge.fury.io/js/compressible.svg)](https://badge.fury.io/js/compressible)
-
-Compressible `Content-Type` / `mime` checking.
-
-```sh
-$ npm install compressible
-```
-
-## API
-
-### compressible(type)
-
-```js
-var compressible = require('compressible')
-compressible('text/html') // => true
-compressible('image/png') // => false
-```
-
-### compressible.get(type)
-
-Returns the specifications object associated with the given `Content-Type`.
-Generates an object using the regex if none is found.
-
-### compressible.specs
-
-Exports `specifications.json`.
-
-### compressible.regex
-
-The regular expression that checks the `Content-Type`.
-However, you should use `compressible(type)` instead of this regular expression due to additional non-regex checks.
-
-## License
-
 The MIT License (MIT)
 
 Copyright (c) 2013 Jonathan Ong me at jongleberry.com
+Copyright (c) 2014 Jeremiah Senkpiel fishrock123 at rocketmail.com
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index 7df7ab0..ecc3342 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,16 @@
 # compressible
 
-[![Build Status](https://travis-ci.org/expressjs/compressible.svg?branch=master)](https://travis-ci.org/expressjs/compressible)
-[![NPM Version](https://badge.fury.io/js/compressible.svg)](https://badge.fury.io/js/compressible)
+[![NPM Version][npm-image]][npm-url]
+[![NPM Downloads][downloads-image]][downloads-url]
+[![Node.js Version][node-version-image]][node-version-url]
+[![Build Status][travis-image]][travis-url]
+[![Test Coverage][coveralls-image]][coveralls-url]
 
 Compressible `Content-Type` / `mime` checking.
 
-```sh
+### Installation
+
+```bash
 $ npm install compressible
 ```
 
@@ -13,46 +18,24 @@ $ npm install compressible
 
 ### compressible(type)
 
+Checks if the given content-type is compressible.
+
 ```js
 var compressible = require('compressible')
+
 compressible('text/html') // => true
 compressible('image/png') // => false
 ```
 
-### compressible.get(type)
-
-Returns the specifications object associated with the given `Content-Type`.
-Generates an object using the regex if none is found.
-
-### compressible.specs
-
-Exports `specifications.json`.
-
-### compressible.regex
-
-The regular expression that checks the `Content-Type`.
-However, you should use `compressible(type)` instead of this regular expression due to additional non-regex checks.
-
-## License
-
-The MIT License (MIT)
-
-Copyright (c) 2013 Jonathan Ong me at jongleberry.com
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
+## [MIT Licensed](LICENSE)
+
+[npm-image]: https://img.shields.io/npm/v/compressible.svg?style=flat
+[npm-url]: https://npmjs.org/package/compressible
+[node-version-image]: https://img.shields.io/badge/node.js-%3E%3D_0.6-brightgreen.svg?style=flat
+[node-version-url]: http://nodejs.org/download/
+[travis-image]: https://img.shields.io/travis/jshttp/compressible.svg?style=flat
+[travis-url]: https://travis-ci.org/jshttp/compressible
+[coveralls-image]: https://img.shields.io/coveralls/jshttp/compressible.svg?style=flat
+[coveralls-url]: https://coveralls.io/r/jshttp/compressible?branch=master
+[downloads-image]: https://img.shields.io/npm/dm/compressible.svg?style=flat
+[downloads-url]: https://npmjs.org/package/compressible
diff --git a/index.js b/index.js
index cb5f18f..db1955c 100644
--- a/index.js
+++ b/index.js
@@ -1,30 +1,39 @@
-module.exports = compressible
+/*!
+ * compressible
+ * Copyright(c) 2014 Jeremiah Senkpiel
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
 
-compressible.specs =
-compressible.specifications = require('./specifications.json')
+var db = require('mime-db')
 
-compressible.regex =
-compressible.regexp = /json|text|xml/
+/**
+ * Module exports.
+ */
+
+module.exports = compressible
 
-compressible.get = get
+/**
+ * Checks if a type is compressible.
+ *
+ * @param {string} type
+ * @return {Boolean} compressible
+ */
 
 function compressible(type) {
   if (!type || typeof type !== "string") return false
-  var i = type.indexOf(';')
-    , spec = compressible.specs[~i ? type.slice(0, i) : type]
-  return spec ? spec.compressible : compressible.regex.test(type)
-}
 
-function get(type) {
-  if (!type || typeof type !== "string") return {
-    compressible: false,
-    notes: "Invalid type."
-  }
+  // Strip charset
   var i = type.indexOf(';')
-    , spec = compressible.specs[~i ? type.slice(0, i) : type]
-  return spec ? spec : {
-    compressible: compressible.regex.test(type),
-    sources: ["compressible.regex"],
-    notes: "Automatically generated via regex."
-  }
+  if (~i) type = type.slice(0, i)
+
+  // handle types that have capitals or excess space
+  type = type.trim().toLowerCase()
+  
+  // attempt to look up from database; fallback to regex if not found
+  var mime = db[type]
+  return mime ? mime.compressible : /^text\/|\+json$|\+text$|\+xml$/.test(type)
 }
diff --git a/package.json b/package.json
index 67ef52e..be7b01b 100644
--- a/package.json
+++ b/package.json
@@ -1,38 +1,36 @@
 {
   "name": "compressible",
   "description": "Compressible Content-Type / mime checking",
-  "version": "1.1.0",
-  "author": {
-    "name": "Jonathan Ong",
-    "email": "me at jongleberry.com",
-    "url": "http://jongleberry.com",
-    "twitter": "https://twitter.com/jongleberry"
-  },
-  "contributors": [{
-    "name": "Jeremiah Senkpiel",
-    "email": "fishrock123 at rocketmail.com",
-    "url": "https://searchbeam.jit.su",
-    "twitter": "https://twitter.com/fishrock123"
-  }],
+  "version": "2.0.1",
+  "contributors": [
+    "Jonathan Ong <me at jongleberry.com> (http://jongleberry.com)",
+    "Jeremiah Senkpiel <fishrock123 at rocketmail.com> (https://searchbeam.jit.su)"
+  ],
   "license": "MIT",
-  "repository": {
-    "type": "git",
-    "url": "https://github.com/expressjs/compressible.git"
-  },
-  "bugs": {
-    "mail": "me at jongleberry.com",
-    "url": "https://github.com/expressjs/compressible/issues"
-  },
+  "repository": "jshttp/compressible",
   "keywords": [
     "compress",
     "gzip",
     "mime",
     "content-type"
   ],
+  "dependencies": {
+    "mime-db": "1.x"
+  },
   "devDependencies": {
+    "istanbul": "0",
     "mocha": "~1.20.1"
   },
+  "engines": {
+    "node": ">= 0.6.0"
+  },
+  "files": [
+    "LICENSE",
+    "index.js"
+  ],
   "scripts": {
-    "test": "mocha --reporter spec test/"
+    "test": "mocha --reporter spec --bail --check-leaks test/",
+    "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot -check-leaks",
+    "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot --check-leaks"
   }
 }
diff --git a/specifications.json b/specifications.json
deleted file mode 100644
index 71ef402..0000000
--- a/specifications.json
+++ /dev/null
@@ -1,473 +0,0 @@
-{
-  "application/atom+xml": {
-    "compressible": true,
-    "sources": [
-      "http://en.wikipedia.org/wiki/Atom_(standard)"
-    ]
-  },
-  "application/dart": {
-    "compressible": true
-  },
-  "application/EDI-X12": {
-    "compressible": false
-  },
-  "application/EDIFACT": {
-    "compressible": false
-  },
-  "application/ecmascript": {
-    "compressible": true
-  },
-  "application/font-woff": {
-    "compressible": false
-  },
-  "application/gzip": {
-    "compressible": false
-  },
-  "application/java-archive": {
-    "compressible": false
-  },
-  "application/java-serialized-object": {
-    "compressible": false
-  },
-  "application/java-vm": {
-    "compressible": false
-  },
-  "application/javascript": {
-    "compressible": true
-  },
-  "application/json": {
-    "compressible": true
-  },
-  "application/msword": {
-    "compressible": false
-  },
-  "application/octet-stream": {
-    "compressible": false,
-    "sources": [
-      "https://github.com/broofa/node-mime/blob/master/types/mime.types#L154"
-    ]
-  },
-  "application/ogg": {
-    "compressible": false
-  },
-  "application/pdf": {
-    "compressible": false
-  },
-  "application/pgp-encrypted": {
-    "compressible": false
-  },
-  "application/postscript": {
-    "compressible": true
-  },
-  "application/rdf+xml": {
-    "compressible": true,
-    "sources": [
-      "http://en.wikipedia.org/wiki/RDF/XML"
-    ]
-  },
-  "application/rss+xml": {
-    "compressible": true
-  },
-  "application/rtf": {
-    "compressible": true
-  },
-  "application/soap+xml": {
-    "compressible": true,
-    "sources": [
-      "http://en.wikipedia.org/wiki/SOAP"
-    ]
-  },
-  "application/tar": {
-    "compressible": true
-  },
-  "application/vnd.android.package-archive": {
-    "compressible": false
-  },
-  "application/vnd.dart": {
-    "compressible": true
-  },
-  "application/vnd.google-earth.kml+xml": {
-    "compressible": true,
-    "sources": [
-      "https://developers.google.com/kml/documentation/kml_tut"
-    ]
-  },
-  "application/vnd.google-earth.kmz": {
-    "compressible": false
-  },
-  "application/vnd.mozilla.xul+xml": {
-    "compressible": true,
-    "sources": [
-      "http://en.wikipedia.org/wiki/XUL"
-    ]
-  },
-  "application/vnd.ms-excel": {
-    "compressible": false
-  },
-  "application/vnd.ms-fontobject": {
-    "compressible": true,
-    "sources": [
-      "http://www.phpied.com/gzip-your-font-face-files/"
-    ]
-  },
-  "application/vnd.ms-opentype": {
-    "compressible": true,
-    "sources": [
-      "http://www.phpied.com/gzip-your-font-face-files/"
-    ]
-  },
-  "application/vnd.ms-powerpoint": {
-    "compressible": false
-  },
-  "application/vnd.ms-xpsdocument": {
-    "compressible": false
-  },
-  "application/vnd.oasis.opendocument.graphics": {
-    "compressible": false
-  },
-  "application/vnd.oasis.opendocument.presentation": {
-    "compressible": false
-  },
-  "application/vnd.oasis.opendocument.spreadsheet": {
-    "compressible": false
-  },
-  "application/vnd.oasis.opendocument.text": {
-    "compressible": false,
-    "sources": [
-      "http://en.wikipedia.org/wiki/OpenDocument_technical_specification#File_types"
-    ]
-  },
-  "application/vnd.openxmlformats-officedocument.presentationml.presentation": {
-    "compressible": false
-  },
-  "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
-    "compressible": false
-  },
-  "application/vnd.openxmlformats-officedocument.wordprocessingml.document": {
-    "compressible": false
-  },
-  "application/x-7z-compressed": {
-    "compressible": false
-  },
-  "application/x-bzip": {
-    "compressible": false
-  },
-  "application/x-bzip2": {
-    "compressible": false
-  },
-  "application/x-deb": {
-    "compressible": false
-  },
-  "application/x-dvi": {
-    "compressible": false
-  },
-  "application/x-font-otf": {
-    "compressible": true,
-    "sources": [
-      "http://www.phpied.com/gzip-your-font-face-files/"
-    ]
-  },
-  "application/x-font-ttf": {
-    "compressible": true,
-    "sources": [
-      "http://www.phpied.com/gzip-your-font-face-files/"
-    ]
-  },
-  "application/x-java-jnlp-file": {
-    "compressible": false
-  },
-  "application/x-javascript": {
-    "compressible": true
-  },
-  "application/x-latex": {
-    "compressible": false
-  },
-  "application/x-mpegURL": {
-    "compressible": false
-  },
-  "application/x-pkcs12": {
-    "compressible": false
-  },
-  "application/x-rar-compressed": {
-    "compressible": false
-  },
-  "application/x-sh": {
-    "compressible": true
-  },
-  "application/x-shockwave-flash": {
-    "compressible": false
-  },
-  "application/x-stuffit": {
-    "compressible": false
-  },
-  "application/x-tar": {
-    "compressible": true
-  },
-  "application/x-www-form-urlencode": {
-    "compressible": false
-  },
-  "application/x-xpinstall": {
-    "compressible": false
-  },
-  "application/xhtml+xml": {
-    "compressible": true
-  },
-  "application/xml": {
-    "compressible": true
-  },
-  "application/xml-dtd": {
-    "compressible": true,
-    "sources": [
-      "http://en.wikipedia.org/wiki/Document_type_definition"
-    ]
-  },
-  "application/xop+xml": {
-    "compressible": true
-  },
-  "application/zip": {
-    "compressible": false
-  },
-  "audio/L24": {
-    "compressible": false
-  },
-  "audio/basic": {
-    "compressible": false
-  },
-  "audio/mp4": {
-    "compressible": false
-  },
-  "audio/mpeg": {
-    "compressible": false
-  },
-  "audio/ogg": {
-    "compressible": false
-  },
-  "audio/vnd.rn-realaudio": {
-    "compressible": false
-  },
-  "audio/vnd.wave": {
-    "compressible": false
-  },
-  "audio/vorbis": {
-    "compressible": false
-  },
-  "audio/webm": {
-    "compressible": false
-  },
-  "audio/x-aac": {
-    "compressible": false
-  },
-  "audio/x-caf": {
-    "compressible": false
-  },
-  "font/opentype": {
-    "compressible": true,
-    "sources": [
-      "http://www.phpied.com/gzip-your-font-face-files/"
-    ]
-  },
-  "image/bmp": {
-    "compressible": true,
-    "sources": [
-      "http://stackoverflow.com/a/12770116"
-    ]
-  },
-  "image/gif": {
-    "compressible": false
-  },
-  "image/jpeg": {
-    "compressible": false
-  },
-  "image/pjpeg": {
-    "compressible": false
-  },
-  "image/png": {
-    "compressible": false
-  },
-  "image/svg+xml": {
-    "compressible": true
-  },
-  "image/tiff": {
-    "compressible": false,
-    "sources": [
-      "http://stackoverflow.com/a/12770116"
-    ],
-    "notes": "Gains insignificant in testing."
-  },
-  "image/vnd.adobe.photoshop": {
-    "compressible": true
-  },
-  "image/x-icon": {
-    "compressible": true,
-    "sources": [
-      "http://en.wikipedia.org/wiki/ICO_(file_format)"
-    ],
-    "notes": "Usually a wrapper for .bmp formated images."
-  },
-  "image/x-xcf": {
-    "compressible": false
-  },
-  "message/http": {
-    "compressible": false,
-    "sources": [
-      "http://stackoverflow.com/a/1450163"
-    ],
-    "notes": "It is safest to leave these uncompressed."
-  },
-  "message/imdn+xml": {
-    "compressible": true,
-    "sources": [
-      "http://tools.ietf.org/html/rfc5438"
-    ]
-  },
-  "message/partial": {
-    "compressible": false
-  },
-  "message/rfc822": {
-    "compressible": true,
-    "sources": [
-      "http://en.wikipedia.org/wiki/MIME#Multipart_subtypes"
-    ]
-  },
-  "model/example": {
-    "compressible": false
-  },
-  "model/iges": {
-    "compressible": false
-  },
-  "model/mesh": {
-    "compressible": false
-  },
-  "model/vrml": {
-    "compressible": false
-  },
-  "model/x3d+binary": {
-    "compressible": false
-  },
-  "model/x3d+vrml": {
-    "compressible": false
-  },
-  "model/x3d+xml": {
-    "compressible": true,
-    "sources": [
-      "http://edutechwiki.unige.ch/en/X3D_file_structure"
-    ]
-  },
-  "multipart/alternative": {
-    "compressible": false
-  },
-  "multipart/encrypted": {
-    "compressible": false
-  },
-  "multipart/form-data": {
-    "compressible": false
-  },
-  "multipart/mixed": {
-    "compressible": false
-  },
-  "multipart/related": {
-    "compressible": false
-  },
-  "multipart/signed": {
-    "compressible": false
-  },
-  "text/cache-manifest": {
-    "compressible": true,
-    "sources": [
-      "https://bugzilla.mozilla.org/show_bug.cgi?id=715191#c2"
-    ],
-    "notes": "I think so."
-  },
-  "text/calender": {
-    "compressible": true,
-    "sources": [
-      "http://en.wikipedia.org/wiki/ICalendar"
-    ],
-    "notes": "Probably needs to be uncompressed before sent to iCalender."
-  },
-  "text/cmd": {
-    "compressible": true
-  },
-  "text/css": {
-    "compressible": true
-  },
-  "text/csv": {
-    "compressible": true
-  },
-  "text/html": {
-    "compressible": true
-  },
-  "text/javascript": {
-    "compressible": true
-  },
-  "text/n3": {
-    "compressible": true,
-    "sources": [
-      "http://en.wikipedia.org/wiki/Notation3"
-    ]
-  },
-  "text/plain": {
-    "compressible": true
-  },
-  "text/richtext": {
-    "compressible": true
-  },
-  "text/tab-separated-values": {
-    "compressible": true
-  },
-  "text/uri-list": {
-    "compressible": true
-  },
-  "text/vcard": {
-    "compressible": true
-  },
-  "text/x-gwt-rpc": {
-    "compressible": true
-  },
-  "text/x-jquery-tmpl": {
-    "compressible": true
-  },
-  "text/x-markdown": {
-    "compressible": true
-  },
-  "text/xml": {
-    "compressible": true
-  },
-  "video/mp4": {
-    "compressible": false
-  },
-  "video/mpeg": {
-    "compressible": false
-  },
-  "video/ogg": {
-    "compressible": false
-  },
-  "video/quicktime": {
-    "compressible": false
-  },
-  "video/webm": {
-    "compressible": false
-  },
-  "video/x-flv": {
-    "compressible": false
-  },
-  "video/x-matroska": {
-    "compressible": false
-  },
-  "video/x-ms-wmv": {
-    "compressible": false
-  },
-  "x-shader/x-fragment": {
-    "compressible": true,
-    "sources": [
-      "https://developer.mozilla.org/en-US/docs/Web/WebGL/Adding_2D_content_to_a_WebGL_context",
-      "https://bugzilla.mozilla.org/show_bug.cgi?id=715191#c2"
-    ]
-  },
-  "x-shader/x-vertex": {
-    "compressible": true,
-    "sources": [
-      "https://developer.mozilla.org/en-US/docs/Web/WebGL/Adding_2D_content_to_a_WebGL_context"
-    ]
-  }
-}
diff --git a/test/test.js b/test/test.js
index 976e061..eb7d7fd 100644
--- a/test/test.js
+++ b/test/test.js
@@ -1,13 +1,17 @@
 var assert = require('assert')
-
-var specifications = require('../specifications.json')
+var db = require('mime-db')
 var compressible = require('../')
 
 // None of these should be actual types so that the lookup will never include them.
 var example_types = [
-  { type: 'something/text', should: true },
-  { type: 'type/json', should: true },
-  { type: 'data/beans+xml', should: true },
+  { type: 'text/penguins', should: true },
+  { type: 'something/text', should: false },
+  { type: 'something/frog+TEXT', should: true },
+  { type: 'type/json;askjkl+json', should: false },
+  { type: 'type/+json', should: true },
+  { type: 'data/beans+xml ; charset="utf-8"', should: true },
+  { type: 'can/worms+xml;blaaaah', should: true },
+  { type: 'data/xml', should: false },
   { type: 'asdf/nope', should: false },
   { type: 'cats', should: false }
 ]
@@ -21,23 +25,13 @@ var invalid_types = [
   true
 ]
 
-var object_true = {
-  compressible: true,
-  sources: ["compressible.regex"],
-  notes: "Automatically generated via regex."
-}, object_false = {
-  compressible: false,
-  sources: ["compressible.regex"],
-  notes: "Automatically generated via regex."
-}
-
 describe('Testing if spec lookups are correct.', function () {
-  for (var type in specifications) {
-    var value = specifications[type].compressible
-    it(type + ' should' + (value ? ' ' : ' not ') + 'be compressible', function () {
+  it('All DB `compressible` types should reflect in compressible', function () {
+    for (var type in db) {
+      var value = db[type].compressible
       assert.equal(compressible(type), value)
-    })
-  }
+    }
+  })
 })
 
 describe('Testing if the regex works as intended.', function () {
@@ -48,31 +42,13 @@ describe('Testing if the regex works as intended.', function () {
   })
 })
 
-describe('Testing if getter returns the correct objects.', function () {
-  it('All spec objects should be get-able', function () {
-    for (var type in specifications) {
-      assert.equal(compressible.get(type), specifications[type])
-    }
-  })
-  example_types.forEach(function (example) {
-    it(example.type + ' should generate a ' + (example.should ? 'true' : 'false') + ' object', function () {
-      assert.deepEqual(compressible.get(example.type), example.should ? object_true: object_false)
-    })
-  })
-})
-
 describe('Testing if charsets are handled correctly.', function () {
   it('Charsets should be stripped off without issue', function () {
-    for (var type in specifications) {
-      var value = specifications[type].compressible
+    for (var type in db) {
+      var value = db[type].compressible
       assert.equal(compressible(type + '; charset=utf-8'), value)
     }
   })
-  it('Types with charsets should be get-able', function () {
-    for (var type in specifications) {
-      assert.equal(compressible.get(type + '; charset=utf-8'), specifications[type])
-    }
-  })
 })
 
 describe('Ensuring invalid types do not cause errors.', function () {
@@ -88,3 +64,14 @@ describe('Ensuring invalid types do not cause errors.', function () {
     })
   })
 })
+
+describe('Ensuring types are always stripped correctly.', function () {
+  it('Uppercase types should work', function () {
+    assert.equal(compressible('TEXT/HTML'), true)
+    assert.equal(compressible('TEXT/plain; charset="utf-8"'), true)
+  })
+
+  it('White-spaced types should work', function () {
+    assert.equal(compressible('application/json ; charset="utf-8"'), true)
+  })
+})

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-compressible.git



More information about the Pkg-javascript-commits mailing list