Node-Red configuration
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.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. var assert = require('assert')
  2. var none = require('..')
  3. /**
  4. * Tests.
  5. */
  6. describe('to-no-case', function () {
  7. describe('space', function () {
  8. it('shouldnt touch space case', function () {
  9. assert.equal(none('this is a string'), 'this is a string')
  10. })
  11. })
  12. describe('camel', function () {
  13. it('should remove camel case', function () {
  14. assert.equal(none('thisIsAString'), 'this is a string')
  15. })
  16. })
  17. describe('constant', function () {
  18. it('should remove constant case', function () {
  19. assert.equal(none('THIS_IS_A_STRING'), 'this is a string')
  20. })
  21. })
  22. describe('upper', function () {
  23. it('should not split upper case', function () {
  24. assert.equal(none('UPPERCASE'), 'uppercase')
  25. })
  26. })
  27. describe('lower', function () {
  28. it('should not split lower case', function () {
  29. assert.equal(none('lowercase'), 'lowercase')
  30. })
  31. })
  32. describe('pascal', function () {
  33. it('should remove pascal case', function () {
  34. assert.equal(none('ThisIsAString'), 'this is a string')
  35. })
  36. it('should handle single letter first words', function () {
  37. assert.equal(none('AStringIsThis'), 'a string is this')
  38. })
  39. it('should handle single letter first words with two words', function () {
  40. assert.equal(none('AString'), 'a string')
  41. })
  42. })
  43. describe('slug', function () {
  44. it('should remove slug case', function () {
  45. assert.equal(none('this-is-a-string'), 'this is a string')
  46. })
  47. })
  48. describe('snake', function () {
  49. it('should remove snake case', function () {
  50. assert.equal(none('this_is_a_string'), 'this is a string')
  51. })
  52. })
  53. describe('sentence', function () {
  54. it('should remove sentence case', function () {
  55. assert.equal(none('This is a string.'), 'this is a string.')
  56. })
  57. })
  58. describe('title', function () {
  59. it('should remove title case', function () {
  60. assert.equal(none('This: Is a String'), 'this: is a string')
  61. })
  62. })
  63. describe('junk', function () {
  64. it('should remove casing but preserve characters', function () {
  65. assert.equal(none('rAnDom -junk$__loL!'), 'random -junk$__lol!')
  66. })
  67. it('should remove casing but preserve characters even without white space', function () {
  68. assert.equal(none('$50,000,000'), '$50,000,000')
  69. })
  70. })
  71. describe('non-latin characters', function () {
  72. it('should return identical string', function () {
  73. assert.equal(none('ارژنگ'), 'ارژنگ')
  74. })
  75. })
  76. })