Closed st-h closed 2 years ago
For instance: Found this in my vendor.js from production build:
define("@adopted-ember-addons/ember-stripe-elements/utils/stripe-mock", ["exports"], (function(e) {
"use strict"
Object.defineProperty(e, "__esModule", {
value: !0
}),
e.default = e.stripeEventUtils = void 0
let t = function(e) {
this.publishableKey = e
}
t.prototype.elements = function() {
return {
create: function() {
return {
mount: function() {},
on: function() {},
unmount: function() {}
}
}
}
},
t.prototype.confirmCardPayment = function() {},
t.prototype.createToken = function() {},
t.prototype.createSource = function() {},
t.prototype.createPaymentMethod = function() {},
t.prototype.retrieveSource = function() {},
t.prototype.paymentRequest = function() {},
t.prototype.redirectToCheckout = function() {},
t.prototype.retrievePaymentIntent = function() {},
t.prototype.handleCardPayment = function() {},
t.prototype.handleCardAction = function() {},
t.prototype.confirmPaymentIntent = function() {},
t.prototype.handleCardSetup = function() {},
t.prototype.confirmCardSetup = function() {},
t.prototype.retrieveSetupIntent = function() {},
t.prototype.confirmSetupIntent = function() {}
const r = {
elementType: "card"
},
n = {
...r,
error: void 0,
value: {
postalCode: ""
},
empty: !0,
complete: !1,
brand: "unknown"
},
a = {
...n,
error: {
message: "Your card number is invalid.",
type: "validation_error",
code: "invalid_number"
},
brand: "visa",
value: {
postalCode: "12345"
}
},
i = {
...n,
complete: !0
},
o = {
triggerReady: function(e) {
e._emitEvent("ready")
},
triggerBlur: function(e) {
e._emitEvent("blur", r)
},
triggerFocus: function(e) {
e._emitEvent("focus", r)
},
triggerIncomplete: function(e) {
e._emitEvent("change", n)
},
triggerError: function(e, t={}) {
e._emitEvent("change", {
...a,
...t
})
},
triggerComplete: function(e) {
e._emitEvent("change", i)
},
triggerChange: function(e, t={}) {
e._emitEvent("change", {
...n,
...t
})
}
}
e.stripeEventUtils = o
var c = t
e.default = c
})),
Yeah think all the test helpers should go in the addon-test-support
folder. Here's an example from another project I've worked on:
https://github.com/Tonkpils/ember-sweetalert/tree/master/addon-test-support
Unfortunately I have no open source time at the moment.
By accident I recently noticed that the vendor.js for a production build would also contain the test helpers. I didn't find any time to have a closer look so far, but we should make sure that these files won't end up in a context where it is never needed.