-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setup fsxa #6
Merged
Merged
Setup fsxa #6
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3e77715
feat(fsxa-plugin): work in progress - init fsxa-api
lksmsr 55559ae
fix(nuxt): add polyfill for node:util and globalThis definition
Code42Cate 23ff14a
feat(fsxa-api): init fsxa api
lksmsr 2c1c463
chore(package.json): replace jest with vite
lksmsr 90f8cef
feat(fsxaconfig): add config composable
lksmsr 6fe8d1c
refactor(endpoint): use fsxa singleton
lksmsr 3667149
test(endpoint): add tests for fsxa api setup
lksmsr 205a1a1
feat(endpoint.get): add change event stream endpoint
lksmsr 189dc96
fix(.env.template): add base url
lksmsr 2e69efc
Merge branch 'main' into setup-fsxa
lksmsr ee4722e
ci(github/workflows): fix failing tests
lksmsr 318318f
ci(e2eTests): fix missing envs
lksmsr 99d5026
fix(endpoint): missing imports from fsxa-api
lksmsr 778d66e
fix(setup-fsxa): minor issues
lksmsr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,3 +1,6 @@ | ||
# unplugin-auto-import | ||
auto-imports.d.ts | ||
|
||
# Mac | ||
.DS_Store | ||
|
||
|
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,11 @@ | ||
import { LogLevel } from "fsxa-api"; | ||
import { FSXAFileConfig } from "./types"; | ||
|
||
const fsxaConfig: FSXAFileConfig = { | ||
logLevel: LogLevel.NONE, | ||
devMode: false, | ||
defaultLocale: "de_DE", | ||
enableEventStream: false, | ||
}; | ||
|
||
export default defineAppConfig(fsxaConfig); |
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,3 +1,3 @@ | ||
{ | ||
"cyBaseUrl": "http://localhost:3000" | ||
"cyBaseURL": "http://localhost:3000" | ||
} |
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,239 @@ | ||
import { ComparisonQueryOperatorEnum } from "fsxa-api"; | ||
import { ServerErrors, FSXAProxyRoutes, FSXAApiErrors } from "~/types"; | ||
|
||
const baseURL = Cypress.env("cyBaseURL"); | ||
|
||
describe(`post to /api${FSXAProxyRoutes.FETCH_ELEMENT_ROUTE}`, () => { | ||
beforeEach(() => { | ||
cy.visit(baseURL); | ||
}); | ||
it(`body contains existing id => return 200 and queried element`, () => { | ||
const id = "ec121aab-e29a-4e35-b97a-3dc33bb50d25"; | ||
cy.request({ | ||
method: "POST", | ||
url: `${baseURL}/api${FSXAProxyRoutes.FETCH_ELEMENT_ROUTE}`, | ||
body: { | ||
locale: "de_DE", | ||
id, | ||
}, | ||
}).should((response) => { | ||
expect(response.body.id).to.eq(id); | ||
expect(response.status).to.eq(200); | ||
}); | ||
}); | ||
|
||
it(`body contains unknown id => return 404`, () => { | ||
const id = "unknownId"; | ||
cy.request({ | ||
method: "POST", | ||
url: `${baseURL}/api${FSXAProxyRoutes.FETCH_ELEMENT_ROUTE}`, | ||
body: { | ||
locale: "de_DE", | ||
id, | ||
}, | ||
failOnStatusCode: false, | ||
}).should((response) => { | ||
expect(response.status).to.eq(404); | ||
expect(response.body.message).to.eq(FSXAApiErrors.NOT_FOUND); | ||
}); | ||
}); | ||
|
||
// TODO | ||
it.skip(`missing permissions => return 401`, () => {}); | ||
|
||
it(`body is invalid => return 500`, () => { | ||
cy.eventNames(); | ||
cy.request({ | ||
method: "POST", | ||
url: `${baseURL}/api${FSXAProxyRoutes.FETCH_ELEMENT_ROUTE}`, | ||
body: { | ||
locale: "de_DE", | ||
}, | ||
failOnStatusCode: false, | ||
}).should((response) => { | ||
expect(response.status).to.eq(500); | ||
expect(response.body.message).to.exist; | ||
}); | ||
}); | ||
}); | ||
|
||
describe(`post to /api${FSXAProxyRoutes.FETCH_BY_FILTER_ROUTE}`, () => { | ||
beforeEach(() => { | ||
cy.visit(baseURL); | ||
}); | ||
it(`query existing elements => return 200 and filtered elements`, () => { | ||
const id = "ec121aab-e29a-4e35-b97a-3dc33bb50d25"; | ||
cy.request({ | ||
method: "POST", | ||
url: `${baseURL}/api${FSXAProxyRoutes.FETCH_BY_FILTER_ROUTE}`, | ||
body: { | ||
locale: "de_DE", | ||
filters: [ | ||
{ | ||
value: id, | ||
field: "identifier", | ||
operator: ComparisonQueryOperatorEnum.EQUALS, | ||
}, | ||
], | ||
}, | ||
}).should((response) => { | ||
expect(response.body.items[0].id).to.eq(id); | ||
expect(response.status).to.eq(200); | ||
}); | ||
}); | ||
|
||
it(`query unknown elements => return 200 and empty items array`, () => { | ||
const id = "unknownId"; | ||
cy.request({ | ||
method: "POST", | ||
url: `${baseURL}/api${FSXAProxyRoutes.FETCH_BY_FILTER_ROUTE}`, | ||
body: { | ||
locale: "de_DE", | ||
filters: [ | ||
{ | ||
value: id, | ||
field: "identifier", | ||
operator: ComparisonQueryOperatorEnum.EQUALS, | ||
}, | ||
], | ||
}, | ||
}).should((response) => { | ||
expect(response.body.items).to.be.empty; | ||
expect(response.status).to.eq(200); | ||
}); | ||
}); | ||
|
||
// TODO | ||
it.skip(`missing permissions => return 401`, () => {}); | ||
|
||
it(`body is invalid => return 500`, () => { | ||
cy.request({ | ||
method: "POST", | ||
url: `${baseURL}/api${FSXAProxyRoutes.FETCH_BY_FILTER_ROUTE}`, | ||
body: { | ||
locale: "de_DE", | ||
filters: [ | ||
{ | ||
field: "identifier", | ||
operator: ComparisonQueryOperatorEnum.EQUALS, | ||
}, | ||
], | ||
}, | ||
failOnStatusCode: false, | ||
}).should((response) => { | ||
expect(response.body.message).to.exist; | ||
expect(response.status).to.eq(500); | ||
}); | ||
}); | ||
}); | ||
|
||
describe(`post to /api${FSXAProxyRoutes.FETCH_NAVIGATION_ROUTE}`, () => { | ||
beforeEach(() => { | ||
cy.visit(baseURL); | ||
}); | ||
it(`body contains valid locale => return navigation data`, () => { | ||
cy.request({ | ||
method: "POST", | ||
url: `${baseURL}/api${FSXAProxyRoutes.FETCH_NAVIGATION_ROUTE}`, | ||
body: { | ||
locale: "de_DE", | ||
}, | ||
}).should((response) => { | ||
expect(response.body).to.have.all.keys([ | ||
"idMap", | ||
"pages", | ||
"seoRouteMap", | ||
"structure", | ||
"meta", | ||
]); | ||
expect(response.status).to.eq(200); | ||
}); | ||
}); | ||
|
||
it(`body contains invalid locale => return 404`, () => { | ||
cy.request({ | ||
method: "POST", | ||
url: `${baseURL}/api${FSXAProxyRoutes.FETCH_NAVIGATION_ROUTE}`, | ||
body: { | ||
locale: "invalid_locale", | ||
}, | ||
failOnStatusCode: false, | ||
}).should((response) => { | ||
expect(response.status).to.eq(404); | ||
expect(response.body.message).to.eq(FSXAApiErrors.NOT_FOUND); | ||
}); | ||
}); | ||
|
||
// TODO | ||
it.skip(`missing permissions => return 401`, () => {}); | ||
|
||
it(`body is invalid => return 500`, () => { | ||
cy.request({ | ||
method: "POST", | ||
url: `${baseURL}/api${FSXAProxyRoutes.FETCH_NAVIGATION_ROUTE}`, | ||
body: { locale: "invalidLocaleFormat" }, | ||
failOnStatusCode: false, | ||
}).should((response) => { | ||
expect(response.status).to.eq(500); | ||
expect(response.body.message).to.exist; | ||
}); | ||
}); | ||
}); | ||
|
||
describe(`post to /api${FSXAProxyRoutes.FETCH_PROPERTIES_ROUTE}`, () => { | ||
beforeEach(() => { | ||
cy.visit(baseURL); | ||
}); | ||
it(`body contains valid locale => return project properties`, () => { | ||
cy.request({ | ||
method: "POST", | ||
url: `${baseURL}/api${FSXAProxyRoutes.FETCH_PROPERTIES_ROUTE}`, | ||
body: { locale: "de_DE" }, | ||
}).should((response) => { | ||
expect(response.body.type).to.eq("ProjectProperties"); | ||
expect(response.status).to.eq(200); | ||
}); | ||
}); | ||
|
||
// TODO | ||
it.skip(`body contains ? => return 404`, () => {}); | ||
|
||
// Tmissing permissions => return 401`, () => {}); | ||
|
||
it(`body is invalid => return 500`, () => { | ||
cy.request({ | ||
method: "POST", | ||
url: `${baseURL}/api${FSXAProxyRoutes.FETCH_PROPERTIES_ROUTE}`, | ||
body: { locale: "invalidLocaleFormat" }, | ||
failOnStatusCode: false, | ||
}).should((response) => { | ||
expect(response.body.message).to.exist; | ||
expect(response.status).to.eq(500); | ||
}); | ||
}); | ||
}); | ||
|
||
it("Unknown route", () => { | ||
cy.visit(baseURL); | ||
cy.request({ | ||
method: "POST", | ||
url: `${baseURL}/api/unknown`, | ||
body: {}, | ||
failOnStatusCode: false, | ||
}).should((response) => { | ||
expect(response.status).to.eq(500); | ||
expect(response.body.message).to.eq(ServerErrors.UNKNOWN_ROUTE); | ||
}); | ||
}); | ||
|
||
it(`get /api${FSXAProxyRoutes.STREAM_CHANGE_EVENTS_ROUTE} => return 200`, () => { | ||
cy.visit(baseURL); | ||
cy.request({ | ||
method: "GET", | ||
url: `${baseURL}/api${FSXAProxyRoutes.STREAM_CHANGE_EVENTS_ROUTE}`, | ||
body: {}, | ||
failOnStatusCode: false, | ||
}).should((response) => { | ||
expect(response.status).to.eq(200); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wir benutzen
BASE_URL
relativ häufig, aber Nuxt ignoriert das komplett (vor allem der port ist relevant). Können wir das noch in der Nuxt config integrieren, damit wir da dieBASE_URL
nicht nochmal hardcoden müssen?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weiß ich nicht genau wie du das meinst... Base url steht in der nuxt config, in der Template ist es hier als optionaler parameter gedacht
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aber wenn du nen gute verbesserung hast, feel free