objectToSaneObject.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // Generated by CoffeeScript 1.6.3
  2. var objectToSaneObject;
  3. require('./_prepare');
  4. objectToSaneObject = mod('objectToSaneObject');
  5. describe("sanitize()");
  6. test("case: 'text'", function() {
  7. var expectation, input, ret;
  8. input = 'text';
  9. expectation = ['text'];
  10. ret = objectToSaneObject.sanitize(input);
  11. return ret.should.be.like(expectation);
  12. });
  13. test("case: ['text']", function() {
  14. var expectation, input, ret;
  15. input = ['text'];
  16. expectation = ['text'];
  17. ret = objectToSaneObject.sanitize(input);
  18. return ret.should.be.like(expectation);
  19. });
  20. test("case: {a:b}", function() {
  21. var expectation, input, ret;
  22. input = {
  23. a: 'b'
  24. };
  25. expectation = [
  26. {
  27. a: ['b']
  28. }
  29. ];
  30. ret = objectToSaneObject.sanitize(input);
  31. return ret.should.be.like(expectation);
  32. });
  33. test("case: {a:[b: 'c']}", function() {
  34. var expectation, input, ret;
  35. input = {
  36. a: [
  37. {
  38. b: 'c'
  39. }
  40. ]
  41. };
  42. expectation = [
  43. {
  44. a: [
  45. {
  46. b: ['c']
  47. }
  48. ]
  49. }
  50. ];
  51. ret = objectToSaneObject.sanitize(input);
  52. return ret.should.be.like(expectation);
  53. });
  54. test("case: {a:b: 'c'}", function() {
  55. var expectation, input, ret;
  56. input = {
  57. a: {
  58. b: 'c'
  59. }
  60. };
  61. expectation = [
  62. {
  63. a: [
  64. {
  65. b: ['c']
  66. }
  67. ]
  68. }
  69. ];
  70. ret = objectToSaneObject.sanitize(input);
  71. return ret.should.be.like(expectation);
  72. });
  73. test("case: {a:b: ['c', d: 'e']}", function() {
  74. var expectation, input, ret;
  75. input = {
  76. a: {
  77. b: [
  78. 'c', {
  79. d: 'e'
  80. }
  81. ]
  82. }
  83. };
  84. expectation = [
  85. {
  86. a: [
  87. {
  88. b: [
  89. 'c', {
  90. d: ['e']
  91. }
  92. ]
  93. }
  94. ]
  95. }
  96. ];
  97. ret = objectToSaneObject.sanitize(input);
  98. return ret.should.be.like(expectation);
  99. });