Skip to content

Commit

Permalink
qrefactor crypto_test.go againts web platform tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aniqaqill authored and Aniq Aqil committed Jan 23, 2025
1 parent 8354419 commit 4b387bb
Show file tree
Hide file tree
Showing 12 changed files with 146 additions and 235 deletions.
358 changes: 134 additions & 224 deletions internal/js/modules/k6/webcrypto/tests/crypto_test.go

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions internal/js/modules/k6/webcrypto/tests/subtle_crypto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
"github.com/stretchr/testify/assert"
)

const webPlatformTestSuite = "./wpt/WebCryptoAPI/"

func TestWebPlatformTestSuite(t *testing.T) {
t.Parallel()

Expand Down
3 changes: 3 additions & 0 deletions internal/js/modules/k6/webcrypto/tests/test_setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
"github.com/stretchr/testify/require"
)

const webPlatformTestSuite = "./wpt/WebCryptoAPI/"

const initGlobals = `
globalThis.CryptoKey = require("k6/x/webcrypto").CryptoKey;
`
Expand Down Expand Up @@ -61,6 +63,7 @@ func newConfiguredRuntime(t testing.TB) *modulestest.Runtime {
return rt
}

// compileAndRun compiles a JavaScript file into a sobek.Program and runs it in the runtime.
func compileAndRun(t testing.TB, runtime *modulestest.Runtime, base, file string) {
program, err := modulestest.CompileFile(base, file)
require.NoError(t, err)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/WebCryptoAPI/derive_bits_keys/ecdh_bits.js b/WebCryptoAPI/derive_bits_keys/ecdh_bits.js
index 36b29c20a..c9c413599 100644
index 36b29c20a2..c9c413599f 100644
--- a/WebCryptoAPI/derive_bits_keys/ecdh_bits.js
+++ b/WebCryptoAPI/derive_bits_keys/ecdh_bits.js
@@ -65,15 +65,17 @@ function define_tests() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/WebCryptoAPI/encrypt_decrypt/aes_gcm_vectors.js b/WebCryptoAPI/encrypt_decrypt/aes_gcm_vectors.js
index 965fe9564..0364b93cd 100644
index 965fe9564d..0364b93cd9 100644
--- a/WebCryptoAPI/encrypt_decrypt/aes_gcm_vectors.js
+++ b/WebCryptoAPI/encrypt_decrypt/aes_gcm_vectors.js
@@ -22,7 +22,10 @@ function getTestVectors() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/WebCryptoAPI/generateKey/failures.js b/WebCryptoAPI/generateKey/failures.js
index e0f0279a6..61495ca75 100644
index e0f0279a69..61495ca75e 100644
--- a/WebCryptoAPI/generateKey/failures.js
+++ b/WebCryptoAPI/generateKey/failures.js
@@ -32,10 +32,10 @@ function run_test(algorithmNames) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/WebCryptoAPI/generateKey/successes.js b/WebCryptoAPI/generateKey/successes.js
index a9a168e1a..88861ab87 100644
index a9a168e1ad..88861ab87f 100644
--- a/WebCryptoAPI/generateKey/successes.js
+++ b/WebCryptoAPI/generateKey/successes.js
@@ -21,17 +21,17 @@ function run_test(algorithmNames, slowTest) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/WebCryptoAPI/import_export/ec_importKey.https.any.js b/WebCryptoAPI/import_export/ec_importKey.https.any.js
index a01bfbb0e..4b7ac8cf0 100644
index a01bfbb0ef..4b7ac8cf05 100644
--- a/WebCryptoAPI/import_export/ec_importKey.https.any.js
+++ b/WebCryptoAPI/import_export/ec_importKey.https.any.js
@@ -72,7 +72,8 @@
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/WebCryptoAPI/import_export/rsa_importKey.https.any.js b/WebCryptoAPI/import_export/rsa_importKey.https.any.js
index c0917cab6..93d16cfc4 100644
index c0917cab68..93d16cfc41 100644
--- a/WebCryptoAPI/import_export/rsa_importKey.https.any.js
+++ b/WebCryptoAPI/import_export/rsa_importKey.https.any.js
@@ -113,7 +113,8 @@
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/WebCryptoAPI/import_export/symmetric_importKey.https.any.js b/WebCryptoAPI/import_export/symmetric_importKey.https.any.js
index 01b318018..7957cb204 100644
index 01b3180189..7957cb204b 100644
--- a/WebCryptoAPI/import_export/symmetric_importKey.https.any.js
+++ b/WebCryptoAPI/import_export/symmetric_importKey.https.any.js
@@ -18,16 +18,17 @@
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/WebCryptoAPI/sign_verify/ecdsa_vectors.js b/WebCryptoAPI/sign_verify/ecdsa_vectors.js
index aa9b81ba8..185c82622 100644
index aa9b81ba8a..185c826220 100644
--- a/WebCryptoAPI/sign_verify/ecdsa_vectors.js
+++ b/WebCryptoAPI/sign_verify/ecdsa_vectors.js
@@ -90,7 +90,9 @@ function getInvalidTestVectors() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/WebCryptoAPI/sign_verify/rsa.js b/WebCryptoAPI/sign_verify/rsa.js
index 5abadd3d4..6076bd7de 100644
index 5abadd3d4b..6076bd7deb 100644
--- a/WebCryptoAPI/sign_verify/rsa.js
+++ b/WebCryptoAPI/sign_verify/rsa.js
@@ -156,7 +156,9 @@ function run_test() {
Expand Down

0 comments on commit 4b387bb

Please sign in to comment.