payment: test fixtures hardcode real gateway names (govpay/lankapay) instead of generic placeholders

Aperta Adatta ai principianti
#122 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
88/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
go
Ambito
testing

Direzione di ricerca

Leggi payment/service_test.go, payment/handler_test.go e payment/registry_test.go; usa gli ID generici esistenti, come gw1, come convenzione. Sostituisci in modo coerente gli ID delle fixture govpay e lankapay, quindi esegui i test del package payment. Il lavoro è terminato quando i test passano con ID generici segnaposto e senza modifiche al comportamento.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

core/payment's own unit tests hardcode a real downstream consumer's gateway name — \"govpay\" — as the fixture gatewayID throughout payment/service_test.go (~25 occurrences) and payment/handler_test.go (4 occurrences), and \"lankapay\" in a couple of places in payment/registry_test.go. Predates #118 (confirmed via git show against a commit before that PR's branch point), though #118 added a few more occurrences following the existing convention.

core/payment is a generic, gateway-agnostic SDK — its own README describes it as "designed to be imported and integrated into other repositories," with GovPay+/LankaPay named only as examples of gateways a consumer might wire up, not anything baked into the framework itself. Hardcoding a specific real downstream integration's name into the framework's own generic unit tests:

  • Couples tests that are actually exercising generic PaymentGateway/PaymentService/HTTPHandler mechanics to an integration that doesn't even live in this repo (GovPay+ lives in nsw-srilanka).
  • Reads as if there's GovPay+-specific behavior being tested here, when there isn't — the tests would behave identically with any gateway ID.
  • Is already inconsistent within the package: registry_test.go uses clearly-generic placeholder IDs (gw1, method1, method2) in most of its tests, but real names (lankapay) in a couple of others.

Proposed Solution

Standardize on the generic-placeholder convention registry_test.go already partially establishes (e.g. gw1) across service_test.go and handler_test.go, replacing the govpay/lankapay fixture IDs. Mechanical rename, no behavior change — tests pass identically regardless of the string used as the gateway ID.

Scope note

Deliberately not bundled into #118 (which is otherwise unrelated in scope) — flagged there during review and split out as its own follow-up per that PR's discussion.

Lingua principale
Go
Stelle
6
Fork
8
Merge medio
21h 36m
PR unite (30g)
42

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OpenNSW/core

Tutte le issue di OpenNSW/core

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.