ehn-dcc-development / hcert-kotlin

Kotlin multiplatform implementation of the HCERT/DCC specification
Apache License 2.0
25 stars 25 forks source link

javascript: Possible to inject clock? #60

Closed lazka closed 3 years ago

lazka commented 3 years ago

It seem like all decoders (trust list, value,sets rules) check the parsed data against the current clock and fail if they are not longer valid. In combination with the official test data which is only valid for two days this makes it hard to integrate this into unit tests.

Is there any way to fake the current time for testing? (or to disable those checks for testing)

nodh commented 3 years ago

Just specify a fixed clock for the parameter clock in the services, e.g. here https://github.com/ehn-dcc-development/hcert-kotlin/blob/main/src/commonMain/kotlin/ehn/techiop/hcert/kotlin/valueset/ValueSetDecodeService.kt#L24

lazka commented 3 years ago

thanks. Any hints on how to do this via Javascript?

lazka commented 2 years ago

I've mocked the Date class for now..