-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
3,903 additions
and
428 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
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
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
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,24 @@ | ||
--- | ||
tags: mexican | ||
--- | ||
|
||
# Mexican Rice | ||
|
||
Inspo src: [ArnieTex' video](https://www.youtube.com/watch?v=7kSiLTnKw0I) | ||
|
||
## Ingredients | ||
- 1 tbsp oil | ||
- ¾ cups rice | ||
- 1 tsp garlic powder | ||
- 1 tsp onion powder | ||
- 1 pinch of (Mexican) Orégano | ||
- ½ tsp ground cumin | ||
- 1 tsp salt | ||
- ⅓ cup tomato sauce | ||
- 2 cups warm chicken broth | ||
|
||
## Directions | ||
|
||
1. Toast rice in some oil in a cast iron pan or a wide Dutch oven | ||
2. Add in the tomato sauce, spices, simmer for 1–2′, then broth. | ||
3. Add lid and keep lid on until finished. Don’t peek! |
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
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,6 @@ | ||
export class GooglePlacesGeocoder { | ||
|
||
static todoFindLocation() { | ||
return {}; | ||
} | ||
} |
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
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,102 @@ | ||
import {PlaceRepository} from "./place-repository.mjs"; | ||
|
||
const merchantGroupData = {"EN": [{ | ||
"id": "foo-bar-baz-4242-844221", | ||
"name": "Some Merchant Group", | ||
"address": null, | ||
"postcode": null, | ||
"businessData": { | ||
"isHalal": false, | ||
"isInHotel": false, | ||
"isNew": false | ||
}, | ||
"onlineOnly": false, | ||
"translations": { | ||
"en": { | ||
"name": "Some Merchant Group" | ||
} | ||
}, | ||
"city": null, | ||
"cuisine": null, | ||
"isMerchantGroup": true, | ||
"merchants": [ | ||
{ | ||
"id": "aa-bb-cc-dd", | ||
"name": "Le Name", | ||
"address": "Le Address", | ||
"postcode": "L3 P05tc0d3", | ||
"businessData": { | ||
"website": "https://example.org/le-name", | ||
"phone": "0555 888", | ||
"isNew": false, | ||
"isHalal": false, | ||
"isInHotel": false, | ||
"additionalComments": "", | ||
"resyEnabled": false, | ||
"resyApiKey": "", | ||
"resyVenueId": "" | ||
}, | ||
"onlineOnly": false, | ||
"translations": { | ||
"en": { | ||
"name": "The Name", | ||
"address": "The Address", | ||
"postcode": "P05tc0d3" | ||
} | ||
}, | ||
"city": { | ||
"id": "aa-88-33-cc", | ||
"title": "Fancytown", | ||
"translations": { | ||
"en": { | ||
"title": "Fancytown" | ||
}, | ||
"zh_tw": { | ||
"title": "Haiyaaa" | ||
} | ||
} | ||
}, | ||
"cuisine": { | ||
"id": "9933-22", | ||
"title": "Lecker Schmecker", | ||
"translations": { | ||
"en": { | ||
"title": "Yum & Nom" | ||
}, | ||
"zh_tw": { | ||
"title": "Fuiyoooo" | ||
} | ||
} | ||
}, | ||
"isMerchantGroup": false, | ||
"merchants": [], | ||
"showMerchant": true, | ||
"allMerchantsNew": true, | ||
"googleMapsUrl": "https://www.example.org/location", | ||
"takeoutAvailable": null, | ||
"openingSoon": false, | ||
"isInMerchantGroup": true, | ||
"isHalal": false | ||
} | ||
], | ||
"showMerchant": true, | ||
"allMerchantsNew": false, | ||
"googleMapsUrl": null, | ||
"takeoutAvailable": null, | ||
"openingSoon": false, | ||
"isInMerchantGroup": false, | ||
"isHalal": false | ||
}]}; | ||
|
||
test('PlaceRepository can be instantiated from Amex country merchant data with merchant groups', () => { | ||
const placeRepository = | ||
PlaceRepository.fromAmexCountriesMerchantsData(merchantGroupData); | ||
expect(placeRepository.findAll()).toHaveLength(1); | ||
}); | ||
|
||
test('PlaceRepository findByCountry finds by correct country', () => { | ||
const placeRepository = | ||
PlaceRepository.fromAmexCountriesMerchantsData(merchantGroupData); | ||
expect(placeRepository.findByCountry("EN")).toHaveLength(1); | ||
expect(placeRepository.findByCountry("XY")).toHaveLength(0); | ||
}); |
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
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,66 @@ | ||
import { jest } from '@jest/globals'; | ||
|
||
import {Place} from "./place.mjs"; | ||
|
||
const dummyMerchantData = { | ||
"id": "abcde", | ||
"name": "Some Place", | ||
"address": "An Address", | ||
"postcode": "P05TC0D3", | ||
"city": { | ||
"title": "Le City", | ||
}, | ||
"googleMapsUrl": "https://Some.url/@48.7292928,9.1204729,foo", | ||
}; | ||
|
||
test('Place can be instantiated from Amex data', () => { | ||
const place = | ||
Place.fromAmexMerchantData(dummyMerchantData, "DE"); | ||
expect(place).toBeInstanceOf(Place); | ||
}); | ||
|
||
test('Is in country works correctly', () => { | ||
const countryCode = "DE"; | ||
const place = | ||
Place.fromAmexMerchantData(dummyMerchantData, countryCode); | ||
expect(place.isInCountry(countryCode)).toBeTruthy(); | ||
expect(place.isInCountry("whatever")).toBeFalsy(); | ||
}) | ||
|
||
test('JSON is correctly rendered', () => { | ||
const place = | ||
Place.fromAmexMerchantData(dummyMerchantData, "DE"); | ||
expect(place.toJson()).toEqual({ | ||
name: "Some Place", | ||
address: "An Address", | ||
zip: "P05TC0D3", | ||
city: "Le City", | ||
amexId: "abcde", | ||
location: {lat: 48.7292928, lon: 9.1204729, type: "assumed" }, | ||
googleMapsUrl: "https://Some.url/@48.7292928,9.1204729,foo", | ||
countryCode: "DE" | ||
}) | ||
}); | ||
|
||
class MockGeocoder { | ||
static todoFindLocation = jest.fn(() => {return {lat: 42, lon: 42}}) | ||
} | ||
|
||
test('Place abstains from geocoding when location is present', () => { | ||
const place = | ||
Place.fromAmexMerchantData(dummyMerchantData, "DE"); | ||
place.geocode(MockGeocoder); | ||
expect(MockGeocoder.todoFindLocation).toHaveBeenCalledTimes(0); | ||
expect(place.toJson()).toMatchObject({ location: {lat: 48.7292928, lon: 9.1204729, type:"assumed"} }) | ||
}); | ||
|
||
test('Place does geocoding when no assumed location is present (from google url)', () => { | ||
const dummyMerchantDataWithoutLocationHint = dummyMerchantData; | ||
delete dummyMerchantDataWithoutLocationHint.googleMapsUrl; | ||
|
||
const place = | ||
Place.fromAmexMerchantData(dummyMerchantDataWithoutLocationHint, "DE"); | ||
place.geocode(MockGeocoder); | ||
expect(MockGeocoder.todoFindLocation).toHaveBeenCalledTimes(1); | ||
expect(place.toJson()).toMatchObject({ location: {lat: 42, lon: 42, type:"geocoded"} }) | ||
}); |
Oops, something went wrong.