Halkyon's shared packages
A pub workspace of the Dart packages Halkyon's apps share: halkyon_ui, Halkyon's look (the theme, fonts, layout and shared widgets, with texts in English and German), halkyon_core's low-level primitives and halkyon_interop's cross-app contracts. Dart 3.13 with LeanCode's lints, configured once at the root; apps take a package by git, pinned to a signed commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
commit
80fa7b9628
1 changed files with 6762 additions and 0 deletions
52
packages/halkyon_core/test/halkyon_core_test.dart
Normal file
52
packages/halkyon_core/test/halkyon_core_test.dart
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
import 'package:halkyon_core/halkyon_core.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
group('generateUuid', () {
|
||||
test('produces a non-empty string', () {
|
||||
expect(generateUuid(), isNotEmpty);
|
||||
});
|
||||
|
||||
test('produces a valid v4 UUID format', () {
|
||||
// v4 UUID: 8-4-4-4-12 hex characters, with version 4 in the third group.
|
||||
final uuid = generateUuid();
|
||||
expect(
|
||||
uuid,
|
||||
matches(
|
||||
RegExp(
|
||||
r'^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$',
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test('produces different values on successive calls', () {
|
||||
final a = generateUuid();
|
||||
final b = generateUuid();
|
||||
expect(a, isNot(equals(b)));
|
||||
});
|
||||
});
|
||||
|
||||
group('ConsoleLogger', () {
|
||||
test('can be instantiated as const', () {
|
||||
const logger = ConsoleLogger();
|
||||
expect(logger, isA<Logger>());
|
||||
});
|
||||
|
||||
// Note: we don't test that ConsoleLogger actually prints, because
|
||||
// capturing stdout in tests is fragile and the implementation is trivial.
|
||||
// If we add structured logging later, we'll test that more carefully.
|
||||
});
|
||||
|
||||
group('HalkyonException', () {
|
||||
test('is implementable', () {
|
||||
final ex = _TestException('boom');
|
||||
expect(ex, isA<HalkyonException>());
|
||||
expect(ex, isA<Exception>());
|
||||
expect(ex.message, equals('boom'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
class _TestException(@override final String message)
|
||||
implements HalkyonException;
|
||||
Loading…
Reference in a new issue