Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
vstudenichnik-insoft committed Feb 7, 2024
1 parent bb1213f commit bb4f95a
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 37 deletions.
9 changes: 6 additions & 3 deletions src/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ function methods(request, options) {

const { handler, resolve, reject } = this.pendingRequests.shift();

return Promise.resolve().then(handler).then(resolve, reject).finally(() => {
this.nextRequest();
});
return Promise.resolve()
.then(handler)
.then(resolve, reject)
.finally(() => {
this.nextRequest();
});
},

async requestStateSync(handler) {
Expand Down
56 changes: 34 additions & 22 deletions src/cart.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,23 @@ describe('cart', () => {
it('should execute requests sequentially', async () => {
fetch
.mockResponseOnce(
() => new Promise((resolve) => {
setTimeout(() => resolve({ body: JSON.stringify({
...api.cart.state,
grand_total: 1000,
index: 1
})
}), 100);
})
() =>
new Promise((resolve) => {
setTimeout(
() =>
resolve({
body: JSON.stringify({
...api.cart.state,
grand_total: 1000,
index: 1,
}),
}),
100,
);
}),
)
.mockResponseOnce(
() => Promise.resolve({
.mockResponseOnce(() =>
Promise.resolve({
body: JSON.stringify({
...api.cart.state,
waited: true,
Expand All @@ -124,28 +130,34 @@ describe('cart', () => {
}),
)
.mockResponseOnce(
() => new Promise((resolve) => {
setTimeout(() => resolve({ body: JSON.stringify({
...api.cart.state,
index: 3
})
}), 100);
})
() =>
new Promise((resolve) => {
setTimeout(
() =>
resolve({
body: JSON.stringify({
...api.cart.state,
index: 3,
}),
}),
100,
);
}),
)
.mockResponseOnce(
() => Promise.resolve({
.mockResponseOnce(() =>
Promise.resolve({
body: JSON.stringify({
...api.cart.state,
index: 4,
}),
}),
)
.mockResponseOnce(
() => Promise.resolve({
.mockResponseOnce(() =>
Promise.resolve({
body: JSON.stringify({
...api.cart.state,
again: true,
index: 5
index: 5,
}),
}),
);
Expand Down
10 changes: 5 additions & 5 deletions src/currency.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ function methods(request, opt) {
selected() {
if (!this.code) {
this.set(
opt.getCookie('swell-currency') || opt.api.settings.get('store.currency'),
opt.getCookie('swell-currency') ||
opt.api.settings.get('store.currency'),
);
}

Expand Down Expand Up @@ -65,8 +66,7 @@ function methods(request, opt) {
const formatCode = params.code || code;
const formatRate = params.rate || rate;
const formatLocale = params.locale || this.locale;
const formatDecimals =
'decimals' in params ? params.decimals : decimals;
const formatDecimals = 'decimals' in params ? params.decimals : decimals;
const { convert = true } = params;

let formatAmount = amount;
Expand Down Expand Up @@ -167,8 +167,8 @@ function methods(request, opt) {
? 'up'
: 'down'
: diff <= -0.5
? 'down'
: 'up'
? 'down'
: 'up'
: config.round;

switch (direction) {
Expand Down
5 changes: 2 additions & 3 deletions src/payment/google/braintree.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,8 @@ export default class BraintreeGooglePayment extends Payment {

async _onClick(googlePayment, paymentDataRequest) {
try {
const paymentData = await this.googleClient.loadPaymentData(
paymentDataRequest,
);
const paymentData =
await this.googleClient.loadPaymentData(paymentDataRequest);

if (paymentData) {
await this._submitPayment(googlePayment, paymentData);
Expand Down
4 changes: 2 additions & 2 deletions src/products.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ function findPurchaseOption(product, purchaseOption) {
typeof purchaseOption === 'string'
? purchaseOption
: plan !== undefined
? 'subscription'
: 'standard',
? 'subscription'
: 'standard',
);
let option = get(product, `purchase_options.${type}`);
if (!option && type !== 'standard') {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/stripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ function setBancontactOwner(source, data) {
...(billingData.phone
? { phone: billingData.phone }
: account.phone
? { phone: account.phone }
: {}),
? { phone: account.phone }
: {}),
...(!isEmpty(billingAddress) ? { address: billingAddress } : {}),
};
}
Expand Down

0 comments on commit bb4f95a

Please sign in to comment.