You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
854 B

7 years ago
  1. var http = require('http');
  2. var assert = require('assert');
  3. var methods = require('..');
  4. describe('methods', function() {
  5. if (http.METHODS) {
  6. it('is a lowercased http.METHODS', function() {
  7. var lowercased = http.METHODS.map(function(method) {
  8. return method.toLowerCase();
  9. });
  10. assert.deepEqual(lowercased, methods);
  11. });
  12. } else {
  13. it('contains GET, POST, PUT, and DELETE', function() {
  14. assert.notEqual(methods.indexOf('get'), -1);
  15. assert.notEqual(methods.indexOf('post'), -1);
  16. assert.notEqual(methods.indexOf('put'), -1);
  17. assert.notEqual(methods.indexOf('delete'), -1);
  18. });
  19. it('is all lowercase', function() {
  20. for (var i = 0; i < methods.length; i ++) {
  21. assert(methods[i], methods[i].toLowerCase(), methods[i] + " isn't all lowercase");
  22. }
  23. });
  24. }
  25. });