Hi, I'm having a problem with my unit tests when r...
# kotlinx-datetime
d
Hi, I'm having a problem with my unit tests when running them in JavaScript. I'm using
TimeZone.of("Europe/Amsterdam")
, but that is not recognized during unit tests in JS (a
IllegalTimeZoneException
is thrown), presumably because it can't find some asset/resource with time zone information? Is this a known issue, does anyone know how to solve this? The time zone can be found without problem when I run the code normally
i
It's likely that you need to require the npm package with js-joda timezones in tests. We do it this way in our tests: https://github.com/Kotlin/kotlinx-datetime/blob/v0.2.0/core/js/test/JsJodaTimeZoneModule.kt and we're also adding the following npm dependency: https://github.com/Kotlin/kotlinx-datetime/blob/v0.2.0/core/build.gradle.kts#L203
d
That fixed it indeed, thank you so much!