var convert = require('./convert');

test('Convert string', function() {
  var obj = {test: 'value'};
  var opts = {
    prefix: "$",
    suffix: ";",
    suffixLastItem: true,
  };
  var out = '$test:value;';
  expect(convert(obj, opts)).toBe(out);
});

test('Convert string with quotes', function() {
  var obj = {test: '"value"'};
  var opts = {
    prefix: "$",
    suffix: ";",
    suffixLastItem: true,
  };
  var out = '$test:"value";';
  expect(convert(obj, opts)).toBe(out);
});


test('Convert number', function() {
  var obj = {test: 5};
  var opts = {
    prefix: "$",
    suffix: ";",
    suffixLastItem: true,
  };
  var out = '$test:5;';
  expect(convert(obj, opts)).toBe(out);
});

test('Convert array', function() {
  var obj = {test: [1, 2]};
  var opts = {
    prefix: "$",
    suffix: ";",
    suffixLastItem: true,
  };
  var out = '$test:1, 2;';
  expect(convert(obj, opts)).toBe(out);
});

test('Convert object: simple', function() {
  var obj = {test: {a: 1}};
  var opts = {
    prefix: "$",
    suffix: ";",
    suffixLastItem: true,
  };
  var out = '$test:(\na:1\n);';
  expect(convert(obj, opts)).toBe(out);
});

test('Convert object: multi value', function() {
  var obj = {test: {a: 1, b: 2}};
  var opts = {
    prefix: "$",
    suffix: ";",
    suffixLastItem: true,
  };
  var out = '$test:(\na:1,\nb:2\n);';
  expect(convert(obj, opts)).toBe(out);
});

test('Convert object: nested', function() {
  var obj = {test: {a: 1, b: 2, c: {d: 4}}};
  var opts = {
    prefix: "$",
    suffix: ";",
    suffixLastItem: true,
  };
  var out = '$test:(\na:1,\nb:2,\nc:(\nd:4\n)\n);';
  expect(convert(obj, opts)).toBe(out);
});


@@ -1,11 +1,13 @@
-var
+const
  convert
@@ -62,35 +62,37 @@
  function() %7B%0A  
-var
+const
  obj = %7Btest: 'v
@@ -97,27 +97,29 @@
 'value'%7D;%0A  
-var
+const
  opts = %7B%0A  
@@ -175,35 +175,37 @@
 m: true,%0A  %7D;%0A  
-var
+const
  out = '$test:va
@@ -298,35 +298,37 @@
  function() %7B%0A  
-var
+const
  obj = %7Btest: '%22
@@ -335,27 +335,29 @@
 value%22'%7D;%0A  
-var
+const
  opts = %7B%0A  
@@ -413,35 +413,37 @@
 m: true,%0A  %7D;%0A  
-var
+const
  out = '$test:%22v
@@ -527,35 +527,37 @@
  function() %7B%0A  
-var
+const
  obj = %7Btest: 5%7D
@@ -556,27 +556,29 @@
 test: 5%7D;%0A  
-var
+const
  opts = %7B%0A  
@@ -634,35 +634,37 @@
 m: true,%0A  %7D;%0A  
-var
+const
  out = '$test:5;
@@ -740,35 +740,37 @@
  function() %7B%0A  
-var
+const
  obj = %7Btest: %5B1
@@ -774,27 +774,29 @@
  %5B1, 2%5D%7D;%0A  
-var
+const
  opts = %7B%0A  
@@ -852,35 +852,37 @@
 m: true,%0A  %7D;%0A  
-var
+const
  out = '$test:1,
@@ -970,35 +970,37 @@
  function() %7B%0A  
-var
+const
  obj = %7Btest: %7Ba
@@ -1004,27 +1004,29 @@
  %7Ba: 1%7D%7D;%0A  
-var
+const
  opts = %7B%0A  
@@ -1082,35 +1082,37 @@
 m: true,%0A  %7D;%0A  
-var
+const
  out = '$test:(%5C
@@ -1210,35 +1210,37 @@
  function() %7B%0A  
-var
+const
  obj = %7Btest: %7Ba
@@ -1250,27 +1250,29 @@
 , b: 2%7D%7D;%0A  
-var
+const
  opts = %7B%0A  
@@ -1328,35 +1328,37 @@
 m: true,%0A  %7D;%0A  
-var
+const
  out = '$test:(%5C
@@ -1465,19 +1465,21 @@
 n() %7B%0A  
-var
+const
  obj = %7B
@@ -1512,19 +1512,21 @@
 4%7D%7D%7D;%0A  
-var
+const
  opts = 
@@ -1598,11 +1598,13 @@
 ;%0A  
-var
+const
  out

use const instead of var