Compare commits

...

3 Commits

Author SHA1 Message Date
Syed Ali Abbas Zaidi
c5ae08b966 chore: add env variable to enable pact stubs 2023-11-06 13:27:41 +05:00
Abdullah Waheed
ccc23a9514 fix: fixed CORS error 2023-10-30 12:40:28 +05:00
Syed Ali Abbas Zaidi
6dba014d51 test: pact stubs 2023-10-30 11:35:29 +05:00
4 changed files with 205 additions and 1 deletions

View File

@@ -28,3 +28,4 @@ APP_ID=''
MFE_CONFIG_API_URL=''
SEARCH_CATALOG_URL='http://localhost:18000/courses'
ENABLE_SKILLS_BUILDER_PROFILE=''
ENABLE_PACT_STUBS=true

View File

@@ -15,7 +15,7 @@
"snapshot": "fedx-scripts jest --updateSnapshot",
"start": "fedx-scripts webpack-dev-server --progress",
"test": "TZ=UTC fedx-scripts jest --coverage --passWithNoTests",
"stubs": "pact-stub-service ./src/pacts/frontend-app-profile-edx-platform.json --port 18000"
"stubs": "pact-stub-service ./src/pacts/frontend-app-profile-edx-platform.json --port 18000 --cors"
},
"bugs": {
"url": "https://github.com/openedx/frontend-app-profile/issues"

View File

@@ -48,6 +48,7 @@ subscribe(APP_INIT_ERROR, (error) => {
initialize({
messages,
hydrateAuthenticatedUser: true,
isPactStubEnabled: process.env.ENABLE_PACT_STUBS,
handlers: {
config: () => {
mergeConfig({

View File

@@ -57,6 +57,208 @@
},
"status": 200
}
},
{
"description": "A request for user's basic information",
"providerStates": [
{
"name": "I have a user's basic information"
}
],
"request": {
"method": "GET",
"path": "/api/user/v1/accounts/edx"
},
"response": {
"body": {
"bio": "This is my bio",
"country": "ME",
"dateJoined": "2017-06-07T00:44:23Z",
"email": "edx@example.com",
"isActive": true,
"name": "Lemon Seltzer",
"username": "edx",
"yearOfBirth": 1901,
"language_proficiencies": [{"code": "en"}]
},
"headers": {
"Content-Type": "application/json"
},
"matchingRules": {
"body": {
"$": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
}
}
},
"status": 200
}
},
{
"description": "A request for user's basic information",
"providerStates": [
{
"name": "I have a user's basic information"
}
],
"request": {
"method": "POST",
"path": "/login_refresh"
},
"response": {
"body": {
"login": "This is my login_refresh"
},
"headers": {
"Content-Type": "application/json"
},
"matchingRules": {
"body": {
"$": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
}
}
},
"status": 200
}
},
{
"description": "A request for user's basic information",
"providerStates": [
{
"name": "I have a user's basic information"
}
],
"request": {
"method": "GET",
"path": "/csrf/api/v1/token"
},
"response": {
"body": {
"csrfToken": "UYVGuFndy1sJPtAFtXPNQTnkZxZPKSYbvd3KKoKTyk6Vq9k01lg4vSsgjidWbnpt"
},
"headers": {
"Content-Type": "application/json"
},
"matchingRules": {
"body": {
"$": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
}
}
},
"status": 200
}
},
{
"description": "A request for user's basic information",
"providerStates": [
{
"name": "I have a user's basic information"
}
],
"request": {
"method": "GET",
"path": "/api/user/v1/preferences/edx"
},
"response": {
"body": {
"pref-lang": "en"
},
"headers": {
"Content-Type": "application/json"
},
"matchingRules": {
"body": {
"$": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
}
}
},
"status": 200
}
},
{
"description": "A request for user's basic information",
"providerStates": [
{
"name": "I have a user's basic information"
}
],
"request": {
"method": "GET",
"path": "/api/certificates/v0/certificates/edx/"
},
"response": {
"body": [],
"headers": {
"Content-Type": "application/json"
},
"matchingRules": {
"body": {
"$": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
}
}
},
"status": 200
}
},
{
"description": "A request for user's basic information",
"providerStates": [
{
"name": "I have a user's basic information"
}
],
"request": {
"method": "POST",
"path": "/event"
},
"response": {
"body": [],
"headers": {
"Content-Type": "application/json"
},
"matchingRules": {
"body": {
"$": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
}
}
},
"status": 200
}
}
],
"metadata": {