Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor crypto_test.go againts web platform tests #4274

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
358 changes: 134 additions & 224 deletions internal/js/modules/k6/webcrypto/tests/crypto_test.go

Large diffs are not rendered by default.

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