chore: Halkyon Learn moves into apps/learn

Its server, client, app and curator, and the tools that write its
assets (maps, Anki fixtures, icons), as they are; paths are fixed in
the commits that follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-19 20:08:06 +02:00
commit 649499be23
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64
2 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,62 @@
import 'package:halkyon_learn_server/src/publish/release_license.dart';
import 'package:test/test.dart';
void main() {
test('licences that allow passing content on allow publishing', () {
for (final license in [
'CC0-1.0',
'Public domain',
'CC-BY-4.0',
'CC-BY-SA-3.0-US',
'CC-BY-NC-SA-4.0',
'CC-BY-ND-4.0',
'cc-by-nc-nd-4.0',
'ODbL-1.0',
'GFDL-1.3-no-invariants-or-later',
'GPL-3.0-or-later',
'AGPL-3.0-only',
'MIT',
'Apache-2.0',
]) {
expect(allowsPublishing(license), isTrue, reason: license);
}
});
test('no licence, all rights reserved, or one not known to be open '
"doesn't", () {
for (final license in [
null,
'',
' ',
'All Rights Reserved',
'GPLv3',
'Proprietary',
'CC-BY',
'CC-SA-1.0',
]) {
expect(allowsPublishing(license), isFalse, reason: license);
}
});
test('ShareAlike and copyleft licences keep adaptations under them', () {
for (final license in [
'CC-BY-SA-4.0',
'CC-BY-NC-SA-3.0-US',
'GPL-3.0-or-later',
'GFDL-1.3-only',
'ODbL-1.0',
]) {
expect(keepsAdaptations(license), isTrue, reason: license);
}
for (final license in ['CC-BY-4.0', 'CC0-1.0', 'MIT', 'CC-BY-ND-4.0']) {
expect(keepsAdaptations(license), isFalse, reason: license);
}
});
test('"no derivatives" forbids passing on adaptations', () {
expect(forbidsAdaptations('CC-BY-ND-4.0'), isTrue);
expect(forbidsAdaptations('CC-BY-NC-ND-3.0-DE'), isTrue);
expect(forbidsAdaptations('CC-BY-SA-4.0'), isFalse);
expect(forbidsAdaptations('MIT'), isFalse);
});
}

View file

@ -0,0 +1,46 @@
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
import 'package:halkyon_learn_server/src/publish/release_repository.dart';
import 'package:test/test.dart';
void main() {
late Directory folder;
setUp(() async {
folder = await Directory.systemTemp.createTemp('release-repository-');
});
tearDown(() => folder.delete(recursive: true));
const someone = (name: 'Someone', email: 'someone@example.org');
test('reads a release of thousands of files back, as large as a '
"language's vocabulary, without waiting on git for ever", () async {
// git answers each object as it reads its name: once its answers fill
// the pipe, it reads no more names until they are read, so they must
// be read while the names are still being written.
final repository = ReleaseRepository(Directory('${folder.path}/r.git'));
Uint8List cardOf(int index) => utf8.encode(
jsonEncode({'id': 'card-$index', 'payload': 'x' * 900}),
);
await repository.release(
files: {
for (var index = 0; index < 3000; index++)
'cards/card-$index.json': () async => cardOf(index),
},
version: 1,
message: 'v1',
author: someone,
committer: someone,
at: DateTime.utc(2026, 10, 16),
);
final read = await repository
.readJson(1)
.timeout(const Duration(seconds: 30));
expect(read, hasLength(3000));
expect(read['cards/card-42.json'], utf8.decode(cardOf(42)));
}, timeout: const Timeout(Duration(minutes: 2)));
}