halkyon/halkyon_learn_server/test/integration/greeting_endpoint_test.dart
Tizian 「ティツィアーン」 e17d99fa51
chore: scaffold the Serverpod 4 build
Deviations from a stock `serverpod create`:
- Dropped Flutter web support, for two reasons:
  - Appflowy editor had issues in the past, potentially related to the
    Flutter-Web IME bridge. Upstream has also open bugs in relation to
that:
    - AppFlowy-IO/appflowy-editor#1029 [Bug][Web] Unwanted space on click
       and overall space bugs (open)
    - AppFlowy-IO/appflowy-editor#782 [Bug] Editor auto-scrolling when
       pressing space too quickly if placed inside a scrollable (open)
  - Offline-first is a required feature. serverpod_offline_sync's SQLite
    support in browsers, maybe via sqlite3.wasm + OPFS, is not
documented.
- SDK constraints raised to ^3.13.0, instead of ^3.12.2, so enjoy the
  newest language features.
- Pinned to Flutter 3.47.4 via FVM.

Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-09-24 15:32:29 +02:00

24 lines
1.1 KiB
Dart

import 'package:test/test.dart';
// Import the generated test helper file, it contains everything you need.
import 'test_tools/serverpod_test_tools.dart';
void main() {
// This is an example test that uses the `withServerpod` test helper.
// `withServerpod` enables you to call your endpoints directly from the test like regular functions.
// Note that after adding or modifying an endpoint, you will need to run
// `serverpod generate` to update the test tools code.
// Refer to the docs for more information on how to use the test helper.
withServerpod('Given Greeting endpoint', (sessionBuilder, endpoints) {
test(
'when calling `hello` with name then returned greeting includes name',
() async {
// Call the endpoint method by using the `endpoints` parameter and
// pass `sessionBuilder` as a first argument. Refer to the docs on
// how to use the `sessionBuilder` to set up different test scenarios.
final greeting = await endpoints.greeting.hello(sessionBuilder, 'Bob');
expect(greeting.message, 'Hello Bob');
},
);
});
}