|
12 | 12 | */ |
13 | 13 | package elide.runtime.node |
14 | 14 |
|
15 | | -import org.graalvm.polyglot.Value |
16 | 15 | import org.junit.jupiter.api.assertThrows |
17 | 16 | import kotlin.test.Test |
18 | 17 | import kotlin.test.assertEquals |
19 | | -import kotlin.test.assertFalse |
20 | 18 | import kotlin.test.assertIs |
21 | 19 | import kotlin.test.assertNotEquals |
22 | 20 | import kotlin.test.assertTrue |
23 | 21 | import kotlin.test.assertNotNull |
24 | 22 | import kotlin.test.assertNull |
25 | 23 | import elide.annotations.Inject |
26 | | -import elide.runtime.intrinsics.js.err.AbstractJsException |
27 | 24 | import elide.runtime.intrinsics.js.err.RangeError |
28 | | -import elide.runtime.intrinsics.js.err.ValueError |
29 | 25 | import elide.runtime.node.crypto.NodeCryptoModule |
30 | 26 | import elide.testing.annotations.TestCase |
31 | 27 |
|
@@ -298,4 +294,20 @@ import elide.testing.annotations.TestCase |
298 | 294 | }) |
299 | 295 | """ |
300 | 296 | } |
| 297 | + |
| 298 | + @Test fun `randomInt should return min when the range is 1`() = conforms { |
| 299 | + val randomInt = crypto.provide().randomInt(7, 8) |
| 300 | + assertIs<Int>(randomInt, "randomInt should return an Int") |
| 301 | + assertEquals(7, randomInt, "randomInt should return min when range is 1") |
| 302 | + }.guest { |
| 303 | + //language=javascript |
| 304 | + """ |
| 305 | + const crypto = require("crypto") |
| 306 | + const assert = require("assert") |
| 307 | +
|
| 308 | + const randomInt = crypto.randomInt(7, 8); |
| 309 | + assert.equal(typeof randomInt, "number"); |
| 310 | + assert.equal(randomInt, 7, "randomInt should return min when range is 1"); |
| 311 | + """ |
| 312 | + } |
301 | 313 | } |
0 commit comments