-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
List available currency, OS/Software, and region
- Loading branch information
1 parent
a77ef2a
commit d0884ba
Showing
3 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`List metadata: Currency 1`] = ` | ||
[ | ||
"usd (United States – Dollar ($) USD)", | ||
"aud (Australia – Dollar ($) AUD)", | ||
"brl (Brazil – Real (R$) BRL)", | ||
"cad (Canada – Dollar ($) CAD)", | ||
"dkk (Denmark – Krone (kr) DKK)", | ||
"eur (Euro Zone – Euro (€) EUR)", | ||
"inr (India – Rupee (₹) INR)", | ||
"jpy (Japan – Yen (¥) JPY)", | ||
"krw (Korea – Won (₩) KRW)", | ||
"nzd (New Zealand – Dollar ($) NZD)", | ||
"nok (Norway – Krone (kr) NOK)", | ||
"rub (Russia – Ruble (руб) RUB)", | ||
"sek (Sweden – Krona (kr) SEK)", | ||
"chf (Switzerland – Franc (chf) CHF)", | ||
"twd (Taiwan – Dollar (NT$) TWD)", | ||
"gbp (United Kingdom – Pound (£) GBP)", | ||
] | ||
`; | ||
|
||
exports[`List metadata: OS/Software 1`] = ` | ||
[ | ||
"linux (Ubuntu)", | ||
"red-hat (Red Hat Enterprise Linux)", | ||
"rhel-ha (Red Hat Enterprise Linux with HA)", | ||
"rhel-sap-ha (RHEL for SAP with HA)", | ||
"rhel-sap-business (RHEL for SAP Business Applications)", | ||
"sles-basic (SUSE Linux Enterprise + Patching only)", | ||
"sles-standard (SUSE Linux Enterprise + 24x7 Support)", | ||
"sles-hpc-standard (SUSE Linux Enterprise for HPC + 24x7 Support)", | ||
"sles-sap (SUSE Linux Enterprise for SAP Applications + 24x7 Support)", | ||
"ubuntu-pro (Ubuntu Pro)", | ||
"ubuntu-advantage-essential (Ubuntu Advantage Essential (Support))", | ||
"ubuntu-advantage-standard (Ubuntu Advantage Standard (Support))", | ||
"ubuntu-advantage-advanced (Ubuntu Advantage Advanced (Support))", | ||
"ml-server-rhel (Machine Learning Server on Red Hat Enterprise Linux)", | ||
"ml-server-ubuntu (Machine Learning Server on Ubuntu or Centos Linux)", | ||
"sql-server-enterprise-linux (SQL Server Enterprise Ubuntu Linux)", | ||
"sql-server-standard-linux (SQL Server Standard Ubuntu Linux)", | ||
"sql-server-web-linux (SQL Server Web Ubuntu Linux)", | ||
"sql-server-enterprise-redhat (SQL Server Enterprise Red Hat Enterprise Linux)", | ||
"sql-server-standard-redhat (SQL Server Standard Red Hat Enterprise Linux)", | ||
"sql-server-web-redhat (SQL Server Web Red Hat Enterprise Linux)", | ||
"sql-server-enterprise-sles (SQL Server Enterprise SUSE Priority)", | ||
"sql-server-standard-sles (SQL Server Standard SUSE Priority)", | ||
"sql-server-web-sles (SQL Server Web SUSE Priority)", | ||
"windows (Windows OS)", | ||
"biztalk-enterprise (BizTalk Enterprise)", | ||
"biztalk-standard (BizTalk Standard)", | ||
"ml-server-windows (Machine Learning Server)", | ||
"sharepoint (SharePoint)", | ||
"sql-server-enterprise (SQL Server Enterprise)", | ||
"sql-server-standard (SQL Server Standard)", | ||
"sql-server-web (SQL Server Web)", | ||
] | ||
`; | ||
|
||
exports[`List metadata: Region 1`] = ` | ||
[ | ||
"us-central (Central US)", | ||
"us-east (East US)", | ||
"us-east-2 (East US 2)", | ||
"us-north-central (North Central US)", | ||
"us-south-central (South Central US)", | ||
"us-west-central (West Central US)", | ||
"us-west (West US)", | ||
"us-west-2 (West US 2)", | ||
"us-west-3 (West US 3)", | ||
"united-kingdom-south (UK South)", | ||
"united-kingdom-west (UK West)", | ||
"uae-central (UAE Central)", | ||
"uae-north (UAE North)", | ||
"switzerland-north (Switzerland North)", | ||
"switzerland-west (Switzerland West)", | ||
"sweden-central (Sweden Central)", | ||
"sweden-south (Sweden South)", | ||
"spain-central (Spain Central)", | ||
"qatar-central (Qatar Central)", | ||
"poland-central (Poland Central)", | ||
"norway-east (Norway East)", | ||
"norway-west (Norway West)", | ||
"mexico-central (Mexico Central)", | ||
"korea-central (Korea Central)", | ||
"korea-south (Korea South)", | ||
"japan-east (Japan East)", | ||
"japan-west (Japan West)", | ||
"italy-north (Italy North)", | ||
"israel-central (Israel Central)", | ||
"central-india (Central India)", | ||
"south-india (South India)", | ||
"west-india (West India)", | ||
"germany-north (Germany North)", | ||
"germany-west-central (Germany West Central)", | ||
"france-central (France Central)", | ||
"france-south (France South)", | ||
"europe-north (North Europe)", | ||
"europe-west (West Europe)", | ||
"canada-central (Canada Central)", | ||
"canada-east (Canada East)", | ||
"brazil-south (Brazil South)", | ||
"brazil-southeast (Brazil Southeast)", | ||
"usgov-arizona (US Gov Arizona)", | ||
"usgov-texas (US Gov Texas)", | ||
"usgov-virginia (US Gov Virginia)", | ||
"australia-central (Australia Central)", | ||
"australia-central-2 (Australia Central 2)", | ||
"australia-east (Australia East)", | ||
"australia-southeast (Australia Southeast)", | ||
"asia-pacific-east (East Asia)", | ||
"asia-pacific-southeast (Southeast Asia)", | ||
"south-africa-north (South Africa North)", | ||
"south-africa-west (South Africa West)", | ||
] | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import puppeteer from "puppeteer"; | ||
|
||
export default async function listSelectOptions(selectName: string): Promise<string[]> { | ||
const browser = await puppeteer.launch({headless: true}); | ||
try | ||
{ | ||
const page = await browser.newPage(); | ||
await page.goto(`https://azure.microsoft.com/en-us/pricing/details/virtual-machines/windows/`); | ||
|
||
await page.waitForFunction( | ||
async () => { | ||
const applicableVmsAnnouncemnt = <HTMLSpanElement> document.querySelector('#pricing-announcement'); | ||
return applicableVmsAnnouncemnt !== null; | ||
} | ||
); | ||
|
||
const selector = `select[name=${selectName}]`; | ||
return await page.$eval(selector, select => Array.from((<HTMLSelectElement> select).options).map(c => `${c.value} (${c.text})`)); | ||
} | ||
finally | ||
{ | ||
if (browser) { | ||
await browser.close(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import listSelectOptions from "./listSelectOptions"; | ||
|
||
describe('List metadata:', () => { | ||
test('Currency', async () => { | ||
const currencies = await listSelectOptions('currency'); | ||
expect(currencies).toMatchSnapshot(); | ||
}); | ||
|
||
test('OS/Software', async () => { | ||
const currencies = await listSelectOptions('softwareOSType'); | ||
expect(currencies).toMatchSnapshot(); | ||
}); | ||
|
||
test('Region', async () => { | ||
const currencies = await listSelectOptions('region'); | ||
expect(currencies).toMatchSnapshot(); | ||
}); | ||
}); |