a zip code crypto-currency system good for red ONLY

12345678910111213141516171819202122232425262728293031323334
  1. var transform = require('../index.js').transform;
  2. describe('es3ify', function() {
  3. it('should quote property keys', function() {
  4. expect(transform('x = {dynamic: 0, static: 17};'))
  5. .toEqual('x = {dynamic: 0, "static": 17};');
  6. });
  7. it('should quote member properties', function() {
  8. expect(transform('x.dynamic++; x.static++;'))
  9. .toEqual('x.dynamic++; x["static"]++;');
  10. });
  11. it('should remove trailing commas in arrays', function() {
  12. expect(transform('[2, 3, 4,]'))
  13. .toEqual('[2, 3, 4]');
  14. });
  15. it('should keep comments near a trailing comma', function() {
  16. expect(transform('[2, 3, 4 /* = 2^2 */,// = 6 - 2\n]'))
  17. .toEqual('[2, 3, 4 /* = 2^2 */// = 6 - 2\n]');
  18. });
  19. it('should remove trailing commas in objects', function() {
  20. expect(transform('({x: 3, y: 4,})'))
  21. .toEqual('({x: 3, y: 4})');
  22. });
  23. it('should transform everything at once', function() {
  24. expect(transform('({a:2,\tfor :[2,,3,],}\n.class)'))
  25. .toEqual('({a:2,\t"for" :[2,,3]}[\n"class"])');
  26. });
  27. });