Skip to content

Add support for Relic in test tools #2996

Open

Description

@hampuslavin

Feature
Relic endpoints should be just as easy to test as the Serverpod Endpoint classes. To be inline with the current design, a new helper called withRelic should be created. It should have a similar signature with sessionBuilder as the first argument, but instead of endpoints a client object should be given as the second argument.

withRelic('Example Endpoint', (sessionBuilder, client) {
  test('Create user', () {
    var headers = {
      'Content-Type': 'application/json'
    };
    var body = {'name': 'Michael'};
    final response =
        client.post(sessionBuilder, '/users', body, headers);
    expect(response.body['id'], isA<String>);
    expect(response.status, equals(201));
  });
});

The same features and configuration should apply as for the withServerpod helper.

Considerations

A lot of the code in the serverpod_test package will be possible to reuse. The solution should aim to create a solution where the two helpers withServerpod and withRelic share as much code as possible.

Activity

  1. added
    area: test framework
    area: web server
    on Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: test frameworkarea: web server

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions