@@ -65,6 +65,18 @@ test('cycle recovery requires exact table restoration replay and disposal receip
|
||||
expect(landedQaReceiptsVerified($command, json_encode($valid, JSON_THROW_ON_ERROR)."\n".$cleanup))->toBeFalse();
|
||||
});
|
||||
|
||||
test('urgent recovery receipts require the frozen shorter policy as well as exact recovery and disposal', function () {
|
||||
$command = ['php', 'worker.php', 'compras_receipts_test_000000000001', 'recover-urgent'];
|
||||
$rows = [['cycle_post_extension_all_tables_equal' => true, 'cycle_native_replays_without_effects' => true,
|
||||
'cycle_history_and_reserve_restored' => true, 'cycle_reserved_minor' => 12000, 'cycle_pre_extension_all_tables_equal' => true],
|
||||
['isolated_restore_removed' => true], ['urgent_policy_frozen_restored' => true, 'urgent_expire_seconds_restored' => 300]];
|
||||
$output = fn ($records) => implode("\n", array_map(fn ($row) => json_encode($row, JSON_THROW_ON_ERROR), $records));
|
||||
expect(landedQaReceiptsVerified($command, $output($rows)))->toBeTrue()
|
||||
->and(landedQaReceiptsVerified($command, $output(array_slice($rows, 0, 2))))->toBeFalse();
|
||||
$rows[2]['urgent_expire_seconds_restored'] = 1800;
|
||||
expect(landedQaReceiptsVerified($command, $output($rows)))->toBeFalse();
|
||||
});
|
||||
|
||||
test('estimate contention receipts require all native uniqueness races and explicit estimate effects', function () {
|
||||
$command = ['php', 'worker.php', 'compras_receipts_test_000000000001', 'race-estimate'];
|
||||
$rows = [['old_runtime_rejected_before_balance' => true, 'old_estimate_runtime_rejected' => true,
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
use Tempo\Purchasing\Internal\InternalRequisitions;
|
||||
|
||||
require_once __DIR__.'/../../packages/purchasing/bootstrap.php';
|
||||
|
||||
test('browser estimate vectors match the authoritative requisition line amounts', function () {
|
||||
$vectors = json_decode(file_get_contents(__DIR__.'/../Fixtures/requisition-estimates.json'), true, flags: JSON_THROW_ON_ERROR);
|
||||
foreach ($vectors as $vector) {
|
||||
$total = 0;
|
||||
foreach ($vector['lines'] as $line) {
|
||||
$total += InternalRequisitions::line($line['quantity'], $line['unit_price'], $line['tax_rate'])['total_minor'];
|
||||
}
|
||||
expect((string) $total)->toBe($vector['minor']);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user