isHttp2Test.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. var should = require('chai').should();
  2. var isHttp2 = require('../../lib/tools/isHttp2');
  3. describe('isHttp2', function() {
  4. it('should parse the protocol correctly', function() {
  5. isHttp2.getProtocol({
  6. toolsResults: {
  7. phantomas: {
  8. url: 'http://www.yahoo.com'
  9. }
  10. }
  11. }).should.equal('http:');
  12. isHttp2.getProtocol({
  13. toolsResults: {
  14. phantomas: {
  15. url: 'https://www.yahoo.com'
  16. }
  17. }
  18. }).should.equal('https:');
  19. });
  20. it('should parse the domain correctly', function() {
  21. isHttp2.getDomain({
  22. toolsResults: {
  23. phantomas: {
  24. url: 'http://www.yahoo.com'
  25. }
  26. }
  27. }).should.equal('www.yahoo.com');
  28. isHttp2.getDomain({
  29. toolsResults: {
  30. phantomas: {
  31. url: 'https://www.yahoo.com'
  32. }
  33. }
  34. }).should.equal('www.yahoo.com');
  35. });
  36. it('should have a function checkHttp2', function() {
  37. isHttp2.should.have.a.property('checkHttp2').that.is.a('function');
  38. });
  39. });