aboutsummaryrefslogtreecommitdiff
path: root/src/tools/json-to-csv/json-to-csv.e2e.spec.ts
diff options
context:
space:
mode:
authorGravatar Corentin Thomasset <corentin.thomasset74@gmail.com> 2023-06-18 17:57:18 +0200
committerGravatar Corentin Thomasset <corentin.thomasset74@gmail.com> 2023-06-18 18:10:06 +0200
commit69f0bd079fd824dc9e929ccbbaa6bcaab0c38a7c (patch)
tree27d2b1fde22872f3d21dedf7c9af99f42187945b /src/tools/json-to-csv/json-to-csv.e2e.spec.ts
parent4cbd7ac14588e954510340186c6797b19caca593 (diff)
downloadit-tools-69f0bd079fd824dc9e929ccbbaa6bcaab0c38a7c.tar.gz
it-tools-69f0bd079fd824dc9e929ccbbaa6bcaab0c38a7c.tar.zst
it-tools-69f0bd079fd824dc9e929ccbbaa6bcaab0c38a7c.zip
feat(new-tool): json to csv converter
Diffstat (limited to 'src/tools/json-to-csv/json-to-csv.e2e.spec.ts')
-rw-r--r--src/tools/json-to-csv/json-to-csv.e2e.spec.ts29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/tools/json-to-csv/json-to-csv.e2e.spec.ts b/src/tools/json-to-csv/json-to-csv.e2e.spec.ts
new file mode 100644
index 0000000..840469c
--- /dev/null
+++ b/src/tools/json-to-csv/json-to-csv.e2e.spec.ts
@@ -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(),
+ );
+ });
+});