← Blog
2026-10-201 min read15 views

One rule, three runtimes: sharing test vectors across TS, Go and Dart

When frontend, backend and app each implement the same logic, how do you keep them identical?

#Go#Dart#TypeScript#测试

The problem

Currency conversion, ledger amounts, date rules… the same logic lives in Web, backend and Flutter. Change one, forget another, and you get "100 on desktop, 99.99 on mobile".

The fix

Write the cases once as JSON — inputs and expected outputs. All three test suites read the same file.

{ "from": "USD", "to": "JPY", "amount": 100, "rate": 151.2, "expect": 15120 }

Change the vectors first; all three suites go red together, then green together.