mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-20 06:55:06 -04:00
feat(new-tool): json to csv converter
This commit is contained in:
parent
4cbd7ac145
commit
69f0bd079f
7 changed files with 200 additions and 0 deletions
29
src/tools/json-to-csv/json-to-csv.e2e.spec.ts
Normal file
29
src/tools/json-to-csv/json-to-csv.e2e.spec.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
import { expect, test } from '@playwright/test';
|
||||
|
||||
test.describe('Tool - JSON to CSV', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/json-to-csv');
|
||||
});
|
||||
|
||||
test('Has correct title', async ({ page }) => {
|
||||
await expect(page).toHaveTitle('JSON to CSV - IT Tools');
|
||||
});
|
||||
|
||||
test('Provided json is converted to csv', async ({ page }) => {
|
||||
await page.getByTestId('input').fill(`
|
||||
[
|
||||
{'Age': 18.0, 'Salary': 20000.0, 'Gender': 'Male', 'Country': 'Germany', 'Purchased': 'N'},
|
||||
{'Age': 19.0, 'Salary': 22000.0, 'Gender': 'Female', 'Country': 'France', 'Purchased': 'N'},
|
||||
]
|
||||
`);
|
||||
|
||||
const generatedJson = await page.getByTestId('area-content').innerText();
|
||||
|
||||
expect(generatedJson.trim()).toEqual(`
|
||||
Age,Salary,Gender,Country,Purchased
|
||||
18,20000,Male,Germany,N
|
||||
19,22000,Female,France,N
|
||||
`.trim(),
|
||||
);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue