import { formatPastedJsonText } from './theme-json-format.logic';

describe('theme JSON paste formatting', () => {
  it('formats pasted JSON with two-space indentation', () => {
    expect(formatPastedJsonText('{"meta":{"name":"Paste","version":"1"},"tokens":{"colors":{"background":"1 2% 3%"}}}')).toBe([
      '{',
      '  "meta": {',
      '    "name": "Paste",',
      '    "version": "1"',
      '  },',
      '  "tokens": {',
      '    "colors": {',
      '      "background": "1 2% 3%"',
      '    }',
      '  }',
      '}'
    ].join('\n'));
  });

  it('leaves non-JSON paste content to the editor default', () => {
    expect(formatPastedJsonText('backgroundColor: red')).toBeNull();
    expect(formatPastedJsonText('')).toBeNull();
  });
});
