Skip to content

test(core): add ReadResource response shaping assertions - #330

Open
yashmittal02 wants to merge 1 commit into
nitrocloudofficial:mainfrom
yashmittal02:test/read-resource-content-types
Open

test(core): add ReadResource response shaping assertions#330
yashmittal02 wants to merge 1 commit into
nitrocloudofficial:mainfrom
yashmittal02:test/read-resource-content-types

Conversation

@yashmittal02

Copy link
Copy Markdown

Description

Adds explicit tests for ReadResource response shaping based on content.type.

The tests verify that:

  • text resources return their data using the text field.
  • binary resources return Base64-encoded data using the blob field.
  • json resources are stringified and returned using the text field.
  • The resource mimeType is preserved in each response.
  • Valid JSON payloads are handled by the JSON branch without falling through to the default case.

Closes #18

Type of Change

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation update
  • refactor: Internal code change
  • test: Test-only changes
  • chore: Build, CI, or tooling changes

Testing

Ran the targeted core test suite:

npx jest src/core/__tests__/server.extended.test.ts

Result:

  • 1 test suite passed
  • 5 tests passed
  • 0 tests failed

The tests cover text, binary, and json resource response shapes.

Checklist

  • My changes are focused on the issue described.
  • I have added/updated tests for the changed behavior.
  • The relevant test suite passes locally.
  • I have followed the project's coding and contribution guidelines.
  • No unrelated files are included in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Test] ReadResource response shaping by content.type (text/binary/json)

1 participant