aboutsummaryrefslogtreecommitdiff
path: root/src/tools/json-to-toml/json-to-toml.e2e.spec.ts
blob: b2f7587104822cad58e1dedf25d2c2feda5f9800 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { expect, test } from '@playwright/test';

test.describe('Tool - JSON to TOML', () => {
  test.beforeEach(async ({ page }) => {
    await page.goto('/json-to-toml');
  });

  test('Has correct title', async ({ page }) => {
    await expect(page).toHaveTitle('JSON to TOML - IT Tools');
  });

  test('JSON is parsed and outputs clean TOML', async ({ page }) => {
    await page.getByTestId('input').fill(`
{
   "foo": "bar",
   "list": {
      "name": "item",
      "another": {
         "key": "value"
      }
   }
}
    `.trim());

    const generatedJson = await page.getByTestId('area-content').innerText();

    expect(generatedJson.trim()).toEqual(
      `
foo = "bar"

[list]
name = "item"

  [list.another]
  key = "value"
   `.trim(),
    );
  });
});