1
0
Fork 0
mirror of synced 2024-07-02 04:50:44 +12:00
budibase/packages/builder/cypress/support/queryLevelTransformerFunctionWithData.js
Mitch-Budibase c7c4bd607f Env variables & data files
Changes as per PR
-Created files for transformer queries - tests updated accordingly
-Updates for Env variables and usage
-Changes surrounding App Rename testing
2021-11-18 13:47:41 +00:00

27 lines
647 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'}})