Files
portal/app/tests/Unit/External/Yandex360BalanceStoreTest.php
T
Дмитрий 1fef2571e8
Accessibility (Pa11y live) / a11y (push) Has been cancelled
SAST — Semgrep / Semgrep SAST scan (push) Has been cancelled
feat(y360): баланс почты Яндекс 360 — ручной ввод + кнопка Пополнить
email — денежный сервис; сумма вписывается в админке «Система» (Yandex360BalanceStore),
светофор по порогам, кнопка «Открыть оплату»/«Пополнить» → admin.yandex.ru/products.
Робот-скрейпер отклонён (SPA Яндекса враждебен ботам + автопополнение защищает баланс).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 13:34:13 +03:00

37 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
use App\Services\External\Yandex360BalanceStore;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
uses(TestCase::class, RefreshDatabase::class);
it('set сохраняет число, get возвращает float', function () {
$store = new Yandex360BalanceStore;
$store->set(1464.31);
expect($store->get())->toBe(1464.31);
});
it('get возвращает null, когда не задан', function () {
expect((new Yandex360BalanceStore)->get())->toBeNull();
});
it('status отдаёт balance + updated_at', function () {
$store = new Yandex360BalanceStore;
expect($store->status())->toMatchArray(['balance' => null, 'updated_at' => null]);
$store->set(500.0);
$st = $store->status();
expect($st['balance'])->toBe(500.0);
expect($st['updated_at'])->not->toBeNull();
});
it('null очищает баланс', function () {
$store = new Yandex360BalanceStore;
$store->set(500.0);
$store->set(null);
expect($store->get())->toBeNull();
expect($store->status()['balance'])->toBeNull();
});