From 2c25d33882cf65b14a8e6e62f3a6d5fca182c2be Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 17 Jan 2023 04:07:02 +0000 Subject: [PATCH] chore: code formatting --- source/app/web/statics/embed/app.placeholder.js | 6 +++--- source/plugins/sponsorships/index.mjs | 6 +++--- tests/mocks/api/github/graphql/sponsorships.all.mjs | 2 +- tests/mocks/api/github/graphql/sponsorships.default.mjs | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/source/app/web/statics/embed/app.placeholder.js b/source/app/web/statics/embed/app.placeholder.js index 65aa3805..f671abaa 100644 --- a/source/app/web/statics/embed/app.placeholder.js +++ b/source/app/web/statics/embed/app.placeholder.js @@ -458,13 +458,13 @@ }, }) : null), - //Sponsorships - ...(set.plugins.enabled.sponsorships + //Sponsorships + ...(set.plugins.enabled.sponsorships ? ({ sponsorships: { sections: options["sponsorships.sections"].split(",").map(x => x.trim()), amount: faker.datatype.number(1000), - list: new Array(2+faker.datatype.number(8)).fill(null).map(_ => ({ + list: new Array(2 + faker.datatype.number(8)).fill(null).map(_ => ({ login: faker.internet.userName(), avatar: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==", type: "user", diff --git a/source/plugins/sponsorships/index.mjs b/source/plugins/sponsorships/index.mjs index 946446da..26651aba 100644 --- a/source/plugins/sponsorships/index.mjs +++ b/source/plugins/sponsorships/index.mjs @@ -14,7 +14,7 @@ export default async function({login, q, imports, data, graphql, queries, accoun if (sections.includes("amount")) { console.debug(`metrics/compute/${login}/plugins > sponsorships > querying total amount spend`) const {totalSponsorshipAmountAsSponsorInCents, sponsorshipsAsSponsor} = (await graphql(queries.sponsorships({login, account})))[account] - amount = totalSponsorshipAmountAsSponsorInCents/100 + amount = totalSponsorshipAmountAsSponsorInCents / 100 image = "https://github.githubassets.com/images/icons/emoji/hearts_around.png" started = sponsorshipsAsSponsor.nodes[0]?.createdAt ? new Date(sponsorshipsAsSponsor.nodes[0]?.createdAt) : null } @@ -36,7 +36,7 @@ export default async function({login, q, imports, data, graphql, queries, accoun pushed = nodes.length console.debug(`metrics/compute/${login}/sponsorships > retrieved ${pushed} sponsorships events after ${cursor}`) } while ((pushed) && (cursor)) - list.push(...fetched.map(({sponsorable: {login, avatarUrl, url: organization = null}, tier:{name:tier}, privacyLevel:privacy, isActive:active}) => ({login, avatarUrl, type: organization ? "organization" : "user", tier, private: privacy !== "PUBLIC", past:!active}))) + list.push(...fetched.map(({sponsorable: {login, avatarUrl, url: organization = null}, tier: {name: tier}, privacyLevel: privacy, isActive: active}) => ({login, avatarUrl, type: organization ? "organization" : "user", tier, private: privacy !== "PUBLIC", past: !active}))) } await Promise.all(list.map(async user => user.avatar = await imports.imgb64(user.avatarUrl))) } @@ -48,4 +48,4 @@ export default async function({login, q, imports, data, graphql, queries, accoun catch (error) { throw imports.format.error(error) } -} \ No newline at end of file +} diff --git a/tests/mocks/api/github/graphql/sponsorships.all.mjs b/tests/mocks/api/github/graphql/sponsorships.all.mjs index 6823e5b2..9983bad3 100644 --- a/tests/mocks/api/github/graphql/sponsorships.all.mjs +++ b/tests/mocks/api/github/graphql/sponsorships.all.mjs @@ -19,7 +19,7 @@ export default function({faker, query, login = faker.internet.userName()}) { isActive: faker.datatype.boolean(), isOneTimePayment: faker.datatype.boolean(), tier: { - name: "$X a month" + name: "$X a month", }, privacyLevel: "PUBLIC", sponsorable: { diff --git a/tests/mocks/api/github/graphql/sponsorships.default.mjs b/tests/mocks/api/github/graphql/sponsorships.default.mjs index 98040569..1187d6bf 100644 --- a/tests/mocks/api/github/graphql/sponsorships.default.mjs +++ b/tests/mocks/api/github/graphql/sponsorships.default.mjs @@ -3,10 +3,10 @@ export default function({faker, query, login = faker.internet.userName()}) { console.debug("metrics/compute/mocks > mocking graphql api result > sponsorships/default") return ({ user: { - totalSponsorshipAmountAsSponsorInCents:faker.datatype.number(100000), - sponsorshipsAsSponsor:{ - nodes:[{createdAt: `${faker.date.recent()}`}] - } + totalSponsorshipAmountAsSponsorInCents: faker.datatype.number(100000), + sponsorshipsAsSponsor: { + nodes: [{createdAt: `${faker.date.recent()}`}], + }, }, }) }