mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-09 07:35:01 -04:00
feat(json-diff): add new tool to get the diff of two given JSONs
This commit is contained in:
parent
7d7cc99866
commit
80af4a3eea
9 changed files with 559 additions and 1 deletions
28
src/tools/json-diff/json-diff.e2e.spec.ts
Normal file
28
src/tools/json-diff/json-diff.e2e.spec.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.describe('Tool - Json diff', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/json-diff');
|
||||
});
|
||||
|
||||
test('Has correct title', async ({ page }) => {
|
||||
await expect(page).toHaveTitle('JSON diff - IT Tools');
|
||||
});
|
||||
|
||||
test('Compare two identical JSONs with corresponding result message', async ({ page }) => {
|
||||
const json = '{"foo":"bar","list":["item",{"key":"value"}]}';
|
||||
await page.getByTestId('leftJson').fill(json);
|
||||
await page.getByTestId('rightJson').fill(json);
|
||||
|
||||
const generatedResult = await page.getByTestId('result').innerText();
|
||||
|
||||
expect(generatedResult.trim()).toContain('both JSONs are identical');
|
||||
});
|
||||
|
||||
test('Compare two different JSONs with corresponding result message', async ({ page }) => {
|
||||
await page.getByTestId('leftJson').fill('{"foo":"bar","list":["item","item2",{"key":"value"}]}');
|
||||
await page.getByTestId('rightJson').fill('{"foo":"bar","list":["item",{"key":"value"}]}');
|
||||
|
||||
await expect(page.getByTestId('result').getByRole('listitem')).toHaveCount(6);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue