-
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.
Merge pull request #15 from OpenUpSA/fix/broken-images
Fix/broken images
- Loading branch information
Showing
14 changed files
with
1,021 additions
and
22 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,20 @@ | ||
name: Cypress Tests | ||
|
||
on: push | ||
|
||
jobs: | ||
cypress-run: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
# Install npm dependencies, cache them correctly | ||
# and run all Cypress tests | ||
- name: Cypress run | ||
uses: cypress-io/github-action@v6 | ||
env: | ||
AIRTABLE_API_KEY: ${{ secrets.AIRTABLE_API_KEY }} | ||
IMGKIT_PRIVATE_KEY: ${{ secrets.IMGKIT_PRIVATE_KEY }} | ||
with: | ||
build: yarn build | ||
start: yarn start |
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
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,10 @@ | ||
import { defineConfig } from "cypress"; | ||
|
||
export default defineConfig({ | ||
e2e: { | ||
supportFile: false, | ||
setupNodeEvents(on, config) { | ||
// implement node event listeners here | ||
}, | ||
}, | ||
}); |
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,10 @@ | ||
describe("Test Entity Info API endpoint", () => { | ||
it("passes", () => { | ||
cy.request("http://localhost:3000/api/entity-info?id=rec2SisdBnuMAZZJb").as( | ||
"entityInfo" | ||
); | ||
cy.get("@entityInfo").should((response: any) => { | ||
expect(response.body).to.have.property("name"); | ||
}); | ||
}); | ||
}); |
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,8 @@ | ||
describe("Test Power Stations API endpoint", () => { | ||
it("passes", () => { | ||
cy.request("http://localhost:3000/api/power-stations").as("powerStations"); | ||
cy.get("@powerStations").should((response: any) => { | ||
expect(response.body).to.have.property("powerStations"); | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
AIRTABLE_API_KEY=https://airtable.com/create/tokens | ||
GOOGLE_MAPS_API_KEY=https://console.developers.google.com/apis/credentials | ||
URL=http://localhost:3000 | ||
URL=http://localhost:3000 | ||
IMGKIT_PRIVATE_KEY=Base64 encoded private key |
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,27 @@ | ||
export const uploadToImgKit = ( | ||
file: string, | ||
fileName: string, | ||
folder: string | ||
) => { | ||
const url = "https://upload.imagekit.io/api/v2/files/upload"; | ||
const form = new FormData(); | ||
form.append("file", file); | ||
form.append("fileName", fileName); | ||
form.append("folder", folder); | ||
form.append("useUniqueFileName", "false"); | ||
|
||
const options = { | ||
method: "POST", | ||
headers: { | ||
Authorization: `Basic ${process.env.IMGKIT_PRIVATE_KEY}` as string, | ||
Accept: "application/json", | ||
}, | ||
body: form, | ||
}; | ||
|
||
try { | ||
fetch(url, options).catch((error) => console.error("error", error)); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
}; |
Oops, something went wrong.