Skip to content

Commit fa0088c

Browse files
committed
chore(randomInt): remove unused imports from test file, add additional test.
1 parent 6bc32b2 commit fa0088c

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

packages/graalvm/src/test/kotlin/elide/runtime/node/NodeCryptoTest.kt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,16 @@
1212
*/
1313
package elide.runtime.node
1414

15-
import org.graalvm.polyglot.Value
1615
import org.junit.jupiter.api.assertThrows
1716
import kotlin.test.Test
1817
import kotlin.test.assertEquals
19-
import kotlin.test.assertFalse
2018
import kotlin.test.assertIs
2119
import kotlin.test.assertNotEquals
2220
import kotlin.test.assertTrue
2321
import kotlin.test.assertNotNull
2422
import kotlin.test.assertNull
2523
import elide.annotations.Inject
26-
import elide.runtime.intrinsics.js.err.AbstractJsException
2724
import elide.runtime.intrinsics.js.err.RangeError
28-
import elide.runtime.intrinsics.js.err.ValueError
2925
import elide.runtime.node.crypto.NodeCryptoModule
3026
import elide.testing.annotations.TestCase
3127

@@ -298,4 +294,20 @@ import elide.testing.annotations.TestCase
298294
})
299295
"""
300296
}
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+
}
301313
}

0 commit comments

Comments
 (0)