sinew_testing 1.0.0
sinew_testing: ^1.0.0 copied to clipboard
Fakes and test helpers for apps built on Sinew. A dev dependency only.
1.0.0 #
-
mockHttp(…, hooks:): the client is built with devtools' hooks. -
S5:
mockHttp((routes) => routes.on('GET', '/v1/orders').respond(200, body: …, headers: …, delay: …) / .drop(), config:, tokenSource:), a realSinewHttp.dioon a mock adapter that records each request as sent (requests,requestsTo(method, path)), answers a route's responses in order and repeats the last, and drops a connection with the platform adapter's own error (aSocketException; aconnectionErroron the web).fixture(name)readstest/fixtures/<name>on the VM and fetches it in a browser test, throwingMissingFixturewith the path when it's missing.installRecordingReporter()puts the previous reporter back when the test ends, passed or failed.controlledFetch()fails the test when a call is left unanswered. -
S5: a fake for every Sinew interface:
FakeKeyValueStore(a wrong type reads as absent;failNextRead,failNextWrite,failNextWriteWithDiskFull),FakeSecureStore(failNextRead,failNextWrite,loseKey),FakeFieldCipher(no cryptography: a readableenc(…)/enc[context](…)form;failNextDecrypt,rotations),FakeBiometricVault(settableavailabilityNow,nextStore/nextUnlockfailures,invalidate,prompts),FakeRefreshTokenStore,RecordingCrashReporter(reports,codes,clear) andFakeLocalizer(a map with{name}arguments; the key itself ornullwhen missing;requested), besideFakeTokenSourceandFakeNetworkChecker.platformStorageError()anddiskFullError()are thePlatformExceptions a storage plugin throws, so an app'sprocessStorageCallclassifies a fake's failure as a real one's. -
S3:
FakeNetworkChecker, a network checker the test switches withgoOffline()andgoOnline(). -
S3:
package:sinew_testing/paging.dart,ControlledFetchalone without Flutter, for packages tested withdart test(the network fakes now bring in Flutter throughconnectivity_plus). -
S3:
FakeTokenSource, a token source the test drives: it counts refreshes and clears, rotatestoken-1→token-2, and takes anonRefreshto gate a refresh. -
S2:
ControlledFetch, a paging fetch the test answers call by call. -
S0: package skeleton.