You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.6 KiB
45 lines
1.6 KiB
// The recovery annex of lib/src/annex.dart, as TestRecoveryAnnex of
|
|
// datekeys-go: recoveryAnnex holds §79 of the specification of specVersion,
|
|
// from its title to its subsection 79.8, names the version, and ends as the
|
|
// specification does, without a CR; and its UTF-8 bytes have the SHA-256 that
|
|
// tool/recovery_annex_copy.dart took from annex/recovery.md, so that the
|
|
// constant compiled to JavaScript is the file too. It reads no file: it runs
|
|
// on the VM and compiled to JavaScript. test/annex_vm_test.dart compares the
|
|
// constant with the file and the file with §79 of the specification.
|
|
library;
|
|
|
|
import 'dart:convert';
|
|
|
|
import 'package:datekeys/datekeys.dart';
|
|
import 'package:datekeys/src/recovery_annex.g.dart' show recoveryAnnexSha256;
|
|
import 'package:datekeys/src/sha256.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
void main() {
|
|
test('the annex is §79 of the specification $specVersion', () {
|
|
for (final s in [
|
|
'## 79. Anexo informativo: recuperación sin software DateKeys',
|
|
'### 79.8 Lo que el anexo no comprueba',
|
|
'DateKeys v$specVersion,',
|
|
]) {
|
|
expect(recoveryAnnex, contains(s));
|
|
}
|
|
expect(recoveryAnnex, endsWith('conforme.\n'));
|
|
expect(recoveryAnnex, isNot(contains('\r')));
|
|
expect(
|
|
recoveryAnnex,
|
|
startsWith(
|
|
'# Cómo abrir una cápsula DateKeys sin software de DateKeys\n\n',
|
|
),
|
|
);
|
|
});
|
|
|
|
test('its UTF-8 bytes are annex/recovery.md, by their SHA-256', () {
|
|
expect(toHex(sha256(utf8.encode(recoveryAnnex))), recoveryAnnexSha256);
|
|
});
|
|
|
|
test('its file is the name of the .dkc and .recuperacion.txt', () {
|
|
expect(recoveryAnnexSuffix, '.recuperacion.txt');
|
|
});
|
|
}
|