stub stripe and add pretender
This commit is contained in:
parent
bde208ecb6
commit
2c6944e66e
|
@ -0,0 +1,18 @@
|
|||
import { acceptance } from "helpers/qunit-helpers";
|
||||
import { stubStripe } from "discourse/plugins/discourse-patrons/helpers/stripe";
|
||||
|
||||
acceptance("Discourse Patrons", {
|
||||
settings: {
|
||||
discourse_patrons_amounts: "1.00|2.00"
|
||||
},
|
||||
|
||||
beforeEach() {
|
||||
stubStripe();
|
||||
}
|
||||
});
|
||||
|
||||
QUnit.test("viewing", async assert => {
|
||||
await visit("/patrons");
|
||||
|
||||
assert.ok($(".donations-page-payment").length, "has payment form class");
|
||||
});
|
|
@ -1,4 +1,5 @@
|
|||
import componentTest from "helpers/component-test";
|
||||
import { stubStripe } from "discourse/plugins/discourse-patrons/helpers/stripe";
|
||||
|
||||
moduleForComponent("stripe-card", { integration: true });
|
||||
|
||||
|
@ -6,26 +7,7 @@ componentTest("Discourse Patrons stripe card success", {
|
|||
template: `{{stripe-card handleConfirmStripeCard=onSubmit billing=billing}}`,
|
||||
|
||||
beforeEach() {
|
||||
window.Stripe = () => {
|
||||
return {
|
||||
createPaymentMethod() {
|
||||
return new Ember.RSVP.Promise(resolve => {
|
||||
resolve({});
|
||||
});
|
||||
},
|
||||
elements() {
|
||||
return {
|
||||
create() {
|
||||
return {
|
||||
on() {},
|
||||
card() {},
|
||||
mount() {}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
stubStripe();
|
||||
|
||||
this.set(
|
||||
"billing",
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
export default function(helpers) {
|
||||
const { response } = helpers;
|
||||
|
||||
this.get("/patrons", () => response({ email: "hello@example.com" }))
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
export function stubStripe() {
|
||||
window.Stripe = () => {
|
||||
return {
|
||||
createPaymentMethod() {
|
||||
return new Ember.RSVP.Promise(resolve => {
|
||||
resolve({});
|
||||
});
|
||||
},
|
||||
elements() {
|
||||
return {
|
||||
create() {
|
||||
return {
|
||||
on() {},
|
||||
card() {},
|
||||
mount() {}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue