1
0
Fork 0
mirror of synced 2024-06-29 19:41:03 +12:00
budibase/packages/builder/cypress/support/queryLevelTransformerFunctionWithData.js
Mitch-Budibase 863abdb4b3 Commands Update & Query Files
-Updating Commands file to include all recent changes
-Added query files (2 of them) - required for query level transformers testing
-Cypress.json updated to remove "/builder/"
-Updating cypress version in package.json
-Missing }) within addmultioptiondatatype.spec.js
2022-01-21 14:41:53 +00:00

31 lines
666 B
JavaScript

const breweries = data
const totals = {}
for (let brewery of breweries)
{const state = brewery.state
if (totals[state] == null)
{totals[state] = 1
} else
{totals[state]++
}
}
const stateCodes =
{texas: "tx",
colorado: "co",
florida: "fl",
iwoa: "ia",
louisiana: "la",
california: "ca",
pennsylvania: "pa",
georgia: "ga",
"new hampshire": "nh",
virginia: "va",
michigan: "mi",
maryland: "md",
ohio: "oh",
}
const entries = Object.entries(totals)
return entries.map(([state, count]) =>
{const stateCode = stateCodes[state.toLowerCase()]
return { state, count, flag: "http://flags.ox3.in/svg/us/${stateCode}.svg" }
})