diff --git a/package-lock.json b/package-lock.json index ff4ad4492..746bccd2a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14235,9 +14235,9 @@ } }, "node_modules/fast-json-format": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/fast-json-format/-/fast-json-format-0.2.0.tgz", - "integrity": "sha512-HdcxHsca6fqk7vt7Ak4a8JTWZQt3yEPwXk8hBPKCg8PLgX7DmXEbwgv7vLLiinAQxTcSFNyz5OiWr8m4r/0tKA==", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/fast-json-format/-/fast-json-format-0.3.0.tgz", + "integrity": "sha512-B95psGYXJ5XItmxLR6JFcQRQafDyfy8ecHiV/jWCJF9oCIA9/o+wt89cGW61D04xf07yCpIaevvCQbgeJ9w8lQ==", "license": "MIT" }, "node_modules/fast-json-stable-stringify": { @@ -26874,7 +26874,7 @@ "dompurify": "^3.2.4", "escape-html": "^1.0.3", "fast-fuzzy": "^1.12.0", - "fast-json-format": "~0.2.0", + "fast-json-format": "~0.3.0", "file": "^0.2.2", "file-dialog": "^0.0.8", "file-saver": "^2.0.5", diff --git a/packages/bruno-app/package.json b/packages/bruno-app/package.json index f94bfa730..09b5f2741 100644 --- a/packages/bruno-app/package.json +++ b/packages/bruno-app/package.json @@ -28,7 +28,7 @@ "dompurify": "^3.2.4", "escape-html": "^1.0.3", "fast-fuzzy": "^1.12.0", - "fast-json-format": "~0.2.0", + "fast-json-format": "~0.3.0", "file": "^0.2.2", "file-dialog": "^0.0.8", "file-saver": "^2.0.5", diff --git a/tests/response/json-with-bigint-response-formatting/fixtures/collection/bruno.json b/tests/response/json-response-formatting/fixtures/collection/bruno.json similarity index 79% rename from tests/response/json-with-bigint-response-formatting/fixtures/collection/bruno.json rename to tests/response/json-response-formatting/fixtures/collection/bruno.json index 9b60f140b..dd099fd15 100644 --- a/tests/response/json-with-bigint-response-formatting/fixtures/collection/bruno.json +++ b/tests/response/json-response-formatting/fixtures/collection/bruno.json @@ -1,6 +1,6 @@ { "version": "1", - "name": "bigint-test", + "name": "collection", "type": "collection", "ignore": [ "node_modules", diff --git a/tests/response/json-with-bigint-response-formatting/fixtures/collection/bigint-request.bru b/tests/response/json-response-formatting/fixtures/collection/request.bru similarity index 56% rename from tests/response/json-with-bigint-response-formatting/fixtures/collection/bigint-request.bru rename to tests/response/json-response-formatting/fixtures/collection/request.bru index 3f6d4c68b..3b27e47e1 100644 --- a/tests/response/json-with-bigint-response-formatting/fixtures/collection/bigint-request.bru +++ b/tests/response/json-response-formatting/fixtures/collection/request.bru @@ -1,5 +1,5 @@ meta { - name: bigint-request + name: request type: http seq: 1 } @@ -12,6 +12,7 @@ post { body:json { { - "data": 1736184243098437392 + "bigint": 1736184243098437392, + "unicode": ["\u4e00","\u4e8c","\u4e09"] } } diff --git a/tests/response/json-with-bigint-response-formatting/init-user-data/collection-security.json b/tests/response/json-response-formatting/init-user-data/collection-security.json similarity index 50% rename from tests/response/json-with-bigint-response-formatting/init-user-data/collection-security.json rename to tests/response/json-response-formatting/init-user-data/collection-security.json index 76dce43e0..f6470eae3 100644 --- a/tests/response/json-with-bigint-response-formatting/init-user-data/collection-security.json +++ b/tests/response/json-response-formatting/init-user-data/collection-security.json @@ -1,7 +1,7 @@ { "collections": [ { - "path": "{{projectRoot}}/tests/response/json-with-bigint-response-formatting/fixtures/collection", + "path": "{{projectRoot}}/tests/response/json-response-formatting/fixtures/collection", "securityConfig": { "jsSandboxMode": "safe" } diff --git a/tests/response/json-response-formatting/init-user-data/preferences.json b/tests/response/json-response-formatting/init-user-data/preferences.json new file mode 100644 index 000000000..0bf3736be --- /dev/null +++ b/tests/response/json-response-formatting/init-user-data/preferences.json @@ -0,0 +1,6 @@ +{ + "maximized": false, + "lastOpenedCollections": [ + "{{projectRoot}}/tests/response/json-response-formatting/fixtures/collection" + ] +} diff --git a/tests/response/json-with-bigint-response-formatting/json-with-bigint-response-formatting.spec.ts b/tests/response/json-response-formatting/json-response-formatting.spec.ts similarity index 58% rename from tests/response/json-with-bigint-response-formatting/json-with-bigint-response-formatting.spec.ts rename to tests/response/json-response-formatting/json-response-formatting.spec.ts index da38d4a8c..7f77d738f 100644 --- a/tests/response/json-with-bigint-response-formatting/json-with-bigint-response-formatting.spec.ts +++ b/tests/response/json-response-formatting/json-response-formatting.spec.ts @@ -1,20 +1,20 @@ import { test, expect } from '../../../playwright'; import { closeAllCollections } from '../../utils/page'; -test.describe.serial('JSON Response Formatting with BigInt', () => { +test.describe.serial('JSON Response Formatting', () => { test.afterAll(async ({ pageWithUserData: page }) => { // cleanup: close all collections await closeAllCollections(page); }); - test('should handle BigInt values in JSON response formatting', async ({ pageWithUserData: page }) => { + test('should handle BigInt values and unicode chars in JSON response formatting', async ({ pageWithUserData: page }) => { await test.step('Navigate to collection and request', async () => { // Navigate to the test collection - await expect(page.locator('#sidebar-collection-name').getByText('bigint-test')).toBeVisible(); - await page.locator('#sidebar-collection-name').getByText('bigint-test').click(); + await expect(page.locator('#sidebar-collection-name').getByText('collection')).toBeVisible(); + await page.locator('#sidebar-collection-name').getByText('collection').click(); - // Navigate to the bigint request - await page.getByRole('complementary').getByText('bigint-request').click(); + // Navigate to the request + await page.getByRole('complementary').getByText('request').click(); }); await test.step('Send request and verify response', async () => { @@ -28,8 +28,13 @@ test.describe.serial('JSON Response Formatting with BigInt', () => { const responseBody = page.locator('.response-pane'); await expect(responseBody).toBeVisible(); - // The response should echo back our request data - await expect(responseBody).toContainText('"data": 1736184243098437392'); + // The response should preserve `bigint` value precision + await expect(responseBody).toContainText('1736184243098437392'); + + // The response should handle unicode chars + await expect(responseBody).toContainText('一'); + await expect(responseBody).toContainText('二'); + await expect(responseBody).toContainText('三'); }); }); }); diff --git a/tests/response/json-with-bigint-response-formatting/init-user-data/preferences.json b/tests/response/json-with-bigint-response-formatting/init-user-data/preferences.json deleted file mode 100644 index 6c3794630..000000000 --- a/tests/response/json-with-bigint-response-formatting/init-user-data/preferences.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "maximized": false, - "lastOpenedCollections": [ - "{{projectRoot}}/tests/response/json-with-bigint-response-formatting/fixtures/collection" - ] -}