diff --git a/packages/sample-server/package.json b/packages/sample-server/package.json index af5780f..c890fb4 100644 --- a/packages/sample-server/package.json +++ b/packages/sample-server/package.json @@ -19,7 +19,7 @@ "@fastify/autoload": "~5.7.1", "env-var": "~7.3.0", "fastify": "~4.15.0", - "@velocitycareerlabs/vnf-nodejs-wallet-sdk": "^0.8.33" + "@velocitycareerlabs/vnf-nodejs-wallet-sdk": "^0.8.34" }, "devDependencies": { "@jest/globals": "~29.5.0", diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 32a708d..029a2fd 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@velocitycareerlabs/vnf-nodejs-wallet-sdk", - "version": "0.8.33", + "version": "0.8.34", "description": "VNF Wallet SDK Nodejs", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/sdk/src/impl/data/repositories/GenerateOffersRepositoryImpl.ts b/packages/sdk/src/impl/data/repositories/GenerateOffersRepositoryImpl.ts index 6f1c610..805107c 100644 --- a/packages/sdk/src/impl/data/repositories/GenerateOffersRepositoryImpl.ts +++ b/packages/sdk/src/impl/data/repositories/GenerateOffersRepositoryImpl.ts @@ -47,7 +47,7 @@ export default class GenerateOffersRepositoryImpl } parse(offersResponse: Response, sessionToken: VCLToken): VCLOffers { - const payload = JSON.parse(offersResponse.payload); + const payload = offersResponse.payload; if (payload) { if (Array.isArray(payload)) { diff --git a/packages/sdk/test/infrastructure/resources/valid/GenerateOffersMocks.ts b/packages/sdk/test/infrastructure/resources/valid/GenerateOffersMocks.ts index 5136048..d186d4f 100644 --- a/packages/sdk/test/infrastructure/resources/valid/GenerateOffersMocks.ts +++ b/packages/sdk/test/infrastructure/resources/valid/GenerateOffersMocks.ts @@ -3,10 +3,12 @@ export class GenerateOffersMocks { static readonly Offer2: string = "{\"offer2\":\"some offer 2\"}"; static readonly Offers: string = `[${GenerateOffersMocks.Offer1},${GenerateOffersMocks.Offer2}]`; static readonly Challenge: string = "CSASLD10103aa_RW"; - static readonly GeneratedOffersJsonObj: string = `{"offers":${GenerateOffersMocks.Offers},"challenge":"${GenerateOffersMocks.Challenge}"}`; - static readonly GeneratedOffersJsonArr: string = GenerateOffersMocks.Offers; - static readonly GeneratedOffersEmptyJsonObj: string = "{}"; - static readonly GeneratedOffersEmptyJsonArr: string = "[]"; + static readonly GeneratedOffersJsonObj: string = JSON.parse( + `{"offers":${GenerateOffersMocks.Offers},"challenge":"${GenerateOffersMocks.Challenge}"}` + ); + static readonly GeneratedOffersJsonArr: string = JSON.parse(GenerateOffersMocks.Offers); + static readonly GeneratedOffersEmptyJsonObj = {}; + static readonly GeneratedOffersEmptyJsonArr = []; static readonly RealOffers = "{\"offers\":[{\"type\":[\"EducationDegreeStudyV1.0\"],\"issuer\":{\"id\":\"did:ion:EiApMLdMb4NPb8sae9-hXGHP79W1gisApVSE80USPEbtJA\",\"name\":\"Coca Cola\",\"image\":\"https:\\/\\/example.com\\/logo.jpg\"},\"credentialSubject\":{\"@context\":[\"https:\\/\\/lib.velocitynetwork.foundation\\/layer1-context-v1.0.json\"],\"type\":\"EducationDegree\",\"institution\":{\"type\":\"Organization\",\"name\":\"XYZ University with brand\",\"identifier\":\"did:ion:EiApMLdMb4NPb8sae9-hXGHP79W1gisApVSE80USPEbtJA\",\"place\":{\"type\":\"Place\",\"addressLocality\":\"Chicago\",\"addressRegion\":\"US-IL\",\"addressCountry\":\"US\"},\"image\":\"https:\\/\\/www.clipartmax.com\\/png\\/small\\/180-1809319_picture-300-x-300-pixel.png\"},\"school\":{\"type\":\"Organization\",\"name\":\"School of nursing\",\"place\":{\"type\":\"Place\",\"name\":\"Florida Branch\",\"addressLocality\":\"Fort Myers\",\"addressRegion\":\"US-FL\",\"addressCountry\":\"US\"}},\"programName\":\"RN to BSN\",\"programType\":\"1 year full time program\",\"programMode\":\"Online\",\"degreeName\":\"EducationDegreeStudyV1.0\",\"degreeMajor\":[\"Nursing\",\"English\"],\"degreeMinor\":[\"Low\",\"Sociology\"],\"description\":\"Starfield College’s RN to BSN Online Option allows working nurses to advance your degree in as few as 3 semesters.\\n If you are a registered nurse with an active RN license looking to earn your BSN, Chamberlain's online RN to BSN option can help prepare you for the next step in your career.\\n Our RN to BSN online option allows you to earn your degree while you work.\",\"alignment\":[{\"type\":\"AlignmentObject\",\"targetName\":\"Bachelor of Science in Nursing, RN to BSN\",\"targetUrl\":\"https:\\/\\/credentialfinder.org\\/credential\\/5769\\/Bachelor_of_Science_in_Nursing,_RN_to_BSN\",\"targetDescription\":\"The RN to BSN completion program has been developed to address the specific needs of working registered nurses who return to the university to earn the BSN.\",\"targetFramework\":\"Credential Engine's Credential Registry\"}],\"startDate\":\"2022-10\"},\"credentialSchema\":{\"type\":\"JsonSchemaValidator2018\",\"id\":\"https:\\/\\/devlib.velocitynetwork.foundation\\/schemas\\/education-degree-study-v1.0.schema.json\"},\"offerCreationDate\":\"2023-08-27T09:27:15.084Z\",\"offerExpirationDate\":\"2024-08-27T09:27:15.084Z\",\"offerId\":\"6LsoXUY5kT2RZ0tXfuEN-\",\"id\":\"6578897c770790a0fdff7c90\",\"exchangeId\":\"6578896f770790a0fdff7c8f\",\"hash\":\"f3e9a8bd5800e9c293e3103daeca6cfe27b1646431fd917ad667c23b4bdc8523\"},{\"type\":[\"EducationDegreeStudyV1.0\"],\"issuer\":{\"id\":\"did:ion:EiApMLdMb4NPb8sae9-hXGHP79W1gisApVSE80USPEbtJA\",\"name\":\"Coca Cola\",\"image\":\"https:\\/\\/example.com\\/logo.jpg\"},\"credentialSubject\":{\"@context\":[\"https:\\/\\/lib.velocitynetwork.foundation\\/layer1-context-v1.0.json\"],\"type\":\"EducationDegree\",\"institution\":{\"type\":\"Organization\",\"name\":\"XYZ University\",\"identifier\":\"did:ion:EiApMLdMb4NPb8sae9-hXGHP79W1gisApVSE80USPEbtJA\",\"place\":{\"type\":\"Place\",\"addressLocality\":\"Chicago\",\"addressRegion\":\"US-IL\",\"addressCountry\":\"US\"},\"image\":\"https:\\/\\/www.clipartmax.com\\/png\\/small\\/180-1809319_picture-300-x-300-pixel.png\"},\"school\":{\"type\":\"Organization\",\"name\":\"School of nursing\",\"place\":{\"type\":\"Place\",\"name\":\"Florida Branch\",\"addressLocality\":\"Fort Myers\",\"addressRegion\":\"US-FL\",\"addressCountry\":\"US\"}},\"programName\":\"RN to BSN\",\"programType\":\"1 year full time program\",\"programMode\":\"Online\",\"degreeName\":\"EducationDegreeStudyV1.0\",\"degreeMajor\":[\"Nursing\",\"English\"],\"degreeMinor\":[\"Low\",\"Sociology\"],\"description\":\"Starfield College’s RN to BSN Online Option allows working nurses to advance your degree in as few as 3 semesters.\\n If you are a registered nurse with an active RN license looking to earn your BSN, Chamberlain's online RN to BSN option can help prepare you for the next step in your career.\\n Our RN to BSN online option allows you to earn your degree while you work.\",\"alignment\":[{\"type\":\"AlignmentObject\",\"targetName\":\"Bachelor of Science in Nursing, RN to BSN\",\"targetUrl\":\"https:\\/\\/credentialfinder.org\\/credential\\/5769\\/Bachelor_of_Science_in_Nursing,_RN_to_BSN\",\"targetDescription\":\"The RN to BSN completion program has been developed to address the specific needs of working registered nurses who return to the university to earn the BSN.\",\"targetFramework\":\"Credential Engine's Credential Registry\"}],\"startDate\":\"2022-10\"},\"credentialSchema\":{\"type\":\"JsonSchemaValidator2018\",\"id\":\"https:\\/\\/devlib.velocitynetwork.foundation\\/schemas\\/education-degree-study-v1.0.schema.json\"},\"offerCreationDate\":\"2023-08-27T09:21:49.729Z\",\"offerExpirationDate\":\"2024-08-27T09:21:49.729Z\",\"offerId\":\"gcid6O7gOOkGnAmqIrcy3\",\"id\":\"6578897c770790a0fdff7c91\",\"exchangeId\":\"6578896f770790a0fdff7c8f\",\"hash\":\"9cb721e57266f6783158dc7ee68640240929fca8fc6b0299448467ffffa45b68\"},{\"type\":[\"EducationDegreeStudyV1.0\"],\"issuer\":{\"id\":\"did:ion:EiApMLdMb4NPb8sae9-hXGHP79W1gisApVSE80USPEbtJA\"},\"credentialSubject\":{\"@context\":[\"https:\\/\\/lib.velocitynetwork.foundation\\/layer1-context-v1.0.json\"],\"type\":\"EducationDegree\",\"institution\":{\"type\":\"Organization\",\"name\":\"XYZ University\",\"identifier\":\"did:ion:EiApMLdMb4NPb8sae9-hXGHP79W1gisApVSE80USPEbtJA\",\"place\":{\"type\":\"Place\",\"addressLocality\":\"Chicago\",\"addressRegion\":\"US-IL\",\"addressCountry\":\"US\"},\"image\":\"https:\\/\\/www.clipartmax.com\\/png\\/small\\/180-1809319_picture-300-x-300-pixel.png\"},\"school\":{\"type\":\"Organization\",\"name\":\"School of nursing\",\"place\":{\"type\":\"Place\",\"name\":\"Florida Branch\",\"addressLocality\":\"Fort Myers\",\"addressRegion\":\"US-FL\",\"addressCountry\":\"US\"}},\"programName\":\"RN to BSN\",\"programType\":\"1 year full time program\",\"programMode\":\"Online\",\"degreeName\":\"EducationDegreeStudyV1.0\",\"degreeMajor\":[\"Nursing\",\"English\"],\"degreeMinor\":[\"Low\",\"Sociology\"],\"description\":\"Starfield College’s RN to BSN Online Option allows working nurses to advance your degree in as few as 3 semesters.\\n If you are a registered nurse with an active RN license looking to earn your BSN, Chamberlain's online RN to BSN option can help prepare you for the next step in your career.\\n Our RN to BSN online option allows you to earn your degree while you work.\",\"alignment\":[{\"type\":\"AlignmentObject\",\"targetName\":\"Bachelor of Science in Nursing, RN to BSN\",\"targetUrl\":\"https:\\/\\/credentialfinder.org\\/credential\\/5769\\/Bachelor_of_Science_in_Nursing,_RN_to_BSN\",\"targetDescription\":\"The RN to BSN completion program has been developed to address the specific needs of working registered nurses who return to the university to earn the BSN.\",\"targetFramework\":\"Credential Engine's Credential Registry\"}],\"startDate\":\"2022-10\"},\"credentialSchema\":{\"type\":\"JsonSchemaValidator2018\",\"id\":\"https:\\/\\/devlib.velocitynetwork.foundation\\/schemas\\/education-degree-study-v1.0.schema.json\"},\"offerCreationDate\":\"2023-07-08T20:39:02.076Z\",\"offerExpirationDate\":\"2024-07-08T20:39:02.076Z\",\"offerId\":\"-GJXLBwj50QOM39JIRC4c\",\"id\":\"6578897c770790a0fdff7c92\",\"exchangeId\":\"6578896f770790a0fdff7c8f\",\"hash\":\"9cb721e57266f6783158dc7ee68640240929fca8fc6b0299448467ffffa45b68\"},{\"type\":[\"OpenBadgeCredential\"],\"issuer\":{\"id\":\"did:ion:EiApMLdMb4NPb8sae9-hXGHP79W1gisApVSE80USPEbtJA\"},\"credentialSubject\":{\"type\":\"AchievementSubject\",\"achievement\":{\"id\":\"VNF0007\",\"type\":\"Achievement\",\"name\":\"I attended the 2023 Velocity Network Foundation General Assembly\",\"achievementType\":\"Badge\",\"criteria\":{\"narrative\":\"Attendance at the 2023 Velocity Network Foundation General Assembly\"},\"description\":\"Badge awarded to individuals who attended the Velocity Network Foundation General Assembly\",\"image\":{\"id\":\"https:\\/\\/assets.velocitynetwork.foundation\\/developers\\/general\\/vnf-general-assembly-2023.png\",\"type\":\"Image\"},\"alignment\":[{\"type\":\"Alignment\",\"targetName\":\"Velocity Network Foundation Website\",\"targetUrl\":\"https:\\/\\/www.velocitynetwork.foundation\\/\",\"targetFramework\":\"Target Framework\"}]},\"source\":{\"id\":\"did:ion:EiApMLdMb4NPb8sae9-hXGHP79W1gisApVSE80USPEbtJA\",\"name\":\"University of Massachusetts Amherst ion\",\"type\":\"Profile\"}},\"credentialSchema\":{\"type\":\"JsonSchemaValidator2018\",\"id\":\"https:\\/\\/devlib.velocitynetwork.foundation\\/schemas\\/open-badge-credential.schema.json\"},\"offerCreationDate\":\"2023-06-14T13:00:09.898Z\",\"offerExpirationDate\":\"2030-01-01T00:00:00.000Z\",\"offerId\":\"Adam_OBC_3\",\"id\":\"6578897c770790a0fdff7c93\",\"exchangeId\":\"6578896f770790a0fdff7c8f\",\"hash\":\"056fdb38b1279d8d3b074ccdd3d35aeff6740c0b9db4aaca6d04433dc2e4da5e\"},{\"type\":[\"EducationDegreeStudyV1.0\"],\"issuer\":{\"id\":\"did:ion:EiApMLdMb4NPb8sae9-hXGHP79W1gisApVSE80USPEbtJA\"},\"credentialSubject\":{\"@context\":\"https:\\/\\/velocitynetwork.foundation\\/contexts\\/education-degree\",\"institution\":{\"name\":\"Image instead of Logo\",\"identifier\":\"did:ion:EiApMLdMb4NPb8sae9-hXGHP79W1gisApVSE80USPEbtJA\",\"place\":{\"addressLocality\":\"Cardiff\",\"addressRegion\":\"GB-WLS\",\"addressCountry\":\"GB\",\"type\":\"Place\"},\"image\":\"https:\\/\\/upload.wikimedia.org\\/wikipedia\\/commons\\/8\\/84\\/Mozilla_Firefox_3.5_logo.png\",\"type\":\"Organization\"},\"school\":{\"name\":\"College of Liberal Arts and Sciences\",\"place\":{\"name\":\"diff photo\",\"addressLocality\":\"Barry\",\"addressRegion\":\"GB-WLS\",\"addressCountry\":\"GB\",\"type\":\"Place\"},\"type\":\"Organization\"},\"programName\":\"Undergraduate program in psychology\",\"programType\":\"60 credits full program\",\"degreeName\":\"Image instead of Logo\",\"degreeMajor\":[\"Psychology\"],\"degreeMinor\":[\"English\"],\"description\":\"The program prepares students for graduate study, and so emphasizes practice in the research techniques which are used in graduate school and professionally later on.\",\"alignment\":[{\"targetName\":\"Bachelor of Science (BS) in Psychology - General Psychology\",\"targetUrl\":\"https:\\/\\/nces.ed.gov\\/ipeds\\/cipcode\\/cipdetail.aspx?y=55&cipid=88527\",\"targetDescription\":\"A general program that focuses on the scientific study of individual and collective behavior, the physical and environmental bases of behavior, and the analysis and treatment of behavior problems and disorders. Includes instruction in the principles of the various subfields of psychology, research methods, and psychological assessment and testing methods.\",\"targetCode\":\"42.0101\",\"targetFramework\":\"CIP - Classification of Instructional Programs\",\"type\":\"AlignmentObject\"}],\"grade\":{\"scoreMethod\":{\"scoreMethodDescription\":\"Poor, Fair, Good, Very Good\",\"passingScore\":\"Fair\",\"scoreMethodType\":\"CriterionReferenced\"},\"result\":\"Study\",\"passFail\":\"Pass\",\"scoreValue\":\"1.5\",\"type\":\"ScoreMethod\"},\"registrationDate\":\"2021-05-15\",\"startDate\":\"2021-10-01\",\"type\":\"EducationDegree\"},\"credentialSchema\":{\"type\":\"JsonSchemaValidator2018\",\"id\":\"https:\\/\\/devlib.velocitynetwork.foundation\\/schemas\\/education-degree-study-v1.0.schema.json\"},\"offerCreationDate\":\"2022-12-06T11:28:43.574Z\",\"offerExpirationDate\":\"2030-01-01T00:00:00.000Z\",\"offerId\":\"XE50THPBfzAYDKmB1GTvwv\",\"id\":\"6578897c770790a0fdff7c94\",\"exchangeId\":\"6578896f770790a0fdff7c8f\",\"hash\":\"19aa50f902464c25c11458dc19d55a6a45b4232156b5de85443dc922edfc9e64\"},{\"type\":[\"EducationDegreeStudyV1.0\"],\"issuer\":{\"id\":\"did:ion:EiApMLdMb4NPb8sae9-hXGHP79W1gisApVSE80USPEbtJA\",\"name\":\"Coca Cola\",\"image\":\"https:\\/\\/example.com\\/logo.jpg\"},\"credentialSubject\":{\"@context\":[\"https:\\/\\/lib.velocitynetwork.foundation\\/layer1-context-v1.0.json\"],\"type\":\"EducationDegree\",\"institution\":{\"type\":\"Organization\",\"name\":\"XYZ University with brand\",\"identifier\":\"did:ion:EiApMLdMb4NPb8sae9-hXGHP79W1gisApVSE80USPEbtJA\",\"place\":{\"type\":\"Place\",\"addressLocality\":\"Chicago\",\"addressRegion\":\"US-IL\",\"addressCountry\":\"US\"},\"image\":\"https:\\/\\/www.clipartmax.com\\/png\\/small\\/180-1809319_picture-300-x-300-pixel.png\"},\"school\":{\"type\":\"Organization\",\"name\":\"School of nursing\",\"place\":{\"type\":\"Place\",\"name\":\"Florida Branch\",\"addressLocality\":\"Fort Myers\",\"addressRegion\":\"US-FL\",\"addressCountry\":\"US\"}},\"programName\":\"RN to BSN\",\"programType\":\"1 year full time program\",\"programMode\":\"Online\",\"degreeName\":\"EducationDegreeStudyV1.0\",\"degreeMajor\":[\"Nursing\",\"English\"],\"degreeMinor\":[\"Low\",\"Sociology\"],\"description\":\"Starfield College’s RN to BSN Online Option allows working nurses to advance your degree in as few as 3 semesters.\\n If you are a registered nurse with an active RN license looking to earn your BSN, Chamberlain's online RN to BSN option can help prepare you for the next step in your career.\\n Our RN to BSN online option allows you to earn your degree while you work.\",\"alignment\":[{\"type\":\"AlignmentObject\",\"targetName\":\"Bachelor of Science in Nursing, RN to BSN\",\"targetUrl\":\"https:\\/\\/credentialfinder.org\\/credential\\/5769\\/Bachelor_of_Science_in_Nursing,_RN_to_BSN\",\"targetDescription\":\"The RN to BSN completion program has been developed to address the specific needs of working registered nurses who return to the university to earn the BSN.\",\"targetFramework\":\"Credential Engine's Credential Registry\"}],\"startDate\":\"2022-10\"},\"credentialSchema\":{\"type\":\"JsonSchemaValidator2018\",\"id\":\"https:\\/\\/devlib.velocitynetwork.foundation\\/schemas\\/education-degree-study-v1.0.schema.json\"},\"offerCreationDate\":\"2023-08-28T07:25:45.000Z\",\"offerExpirationDate\":\"2025-01-04T08:34:00.162Z\",\"offerId\":\"Offer-2.1 (push)\",\"id\":\"6578897c770790a0fdff7c95\",\"exchangeId\":\"6578896f770790a0fdff7c8f\",\"hash\":\"f3e9a8bd5800e9c293e3103daeca6cfe27b1646431fd917ad667c23b4bdc8523\"},{\"type\":[\"EducationDegreeStudyV1.0\"],\"issuer\":{\"id\":\"did:ion:EiApMLdMb4NPb8sae9-hXGHP79W1gisApVSE80USPEbtJA\"},\"credentialSubject\":{\"@context\":\"https:\\/\\/velocitynetwork.foundation\\/contexts\\/education-degree\",\"institution\":{\"name\":\"University of Massachusetts Amherst ion\",\"identifier\":\"did:ion:EiApMLdMb4NPb8sae9-hXGHP79W1gisApVSE80USPEbtJA\",\"place\":{\"addressLocality\":\"Cardiff\",\"addressRegion\":\"GB-WLS\",\"addressCountry\":\"GB\",\"type\":\"Place\"},\"type\":\"Organization\"},\"school\":{\"name\":\"College of Liberal Arts and Sciences\",\"place\":{\"name\":\"Graduate Studies Building\",\"addressLocality\":\"Barry\",\"addressRegion\":\"GB-WLS\",\"addressCountry\":\"GB\",\"type\":\"Place\"},\"type\":\"Organization\"},\"programName\":\"Undergraduate program in psychology\",\"programType\":\"60 credits full program\",\"degreeName\":\"StudyV1.0\",\"degreeMajor\":[\"Psychology\",\"Psychology2\"],\"degreeMinor\":[\"English\",\"Psychology2\"],\"description\":\"The program prepares students for graduate study, and so emphasizes practice in the research techniques which are used in graduate school and professionally later on.\",\"alignment\":[{\"targetName\":\"Bachelor of Science (BS) in Psychology - General Psychology\",\"targetUrl\":\"https:\\/\\/nces.ed.gov\\/ipeds\\/cipcode\\/cipdetail.aspx?y=55&cipid=88527\",\"targetDescription\":\"A general program that focuses on the scientific study of individual and collective behavior, the physical and environmental bases of behavior, and the analysis and treatment of behavior problems and disorders. Includes instruction in the principles of the various subfields of psychology, research methods, and psychological assessment and testing methods.\",\"targetCode\":\"42.0101\",\"targetFramework\":\"CIP - Classification of Instructional Programs\",\"type\":\"AlignmentObject\"}],\"registrationDate\":\"2021-05-15\",\"startDate\":\"2021-10-01\",\"type\":\"EducationDegree\"},\"credentialSchema\":{\"type\":\"JsonSchemaValidator2018\",\"id\":\"https:\\/\\/devlib.velocitynetwork.foundation\\/schemas\\/education-degree-study-v1.0.schema.json\"},\"offerCreationDate\":\"2022-12-06T11:28:43.574Z\",\"offerExpirationDate\":\"2030-01-01T00:00:00.000Z\",\"offerId\":\"XE50THPBfzAYDKmB1GTvw\",\"id\":\"6578897c770790a0fdff7c96\",\"exchangeId\":\"6578896f770790a0fdff7c8f\",\"hash\":\"10b0e97ed421df2e6ff0e8c033eb64dde12bc3327ad797a6909220fbfb9a7e45\"},{\"type\":[\"EducationDegreeRegistrationV1.0\"],\"issuer\":{\"id\":\"did:ion:EiApMLdMb4NPb8sae9-hXGHP79W1gisApVSE80USPEbtJA\"},\"credentialSubject\":{\"@context\":\"https:\\/\\/velocitynetwork.foundation\\/contexts\\/education-degree\",\"institution\":{\"name\":\"University of Massachusetts Amherst ion\",\"identifier\":\"did:ion:EiApMLdMb4NPb8sae9-hXGHP79W1gisApVSE80USPEbtJA\",\"place\":{\"addressLocality\":\"Chicago\",\"addressRegion\":\"US-IL\",\"addressCountry\":\"US\",\"type\":\"Place\"},\"type\":\"Organization\"},\"school\":{\"name\":\"School of nursing\",\"place\":{\"name\":\"Florida Branch\",\"addressLocality\":\"Fort Myers\",\"addressRegion\":\"US-FL\",\"addressCountry\":\"US\",\"type\":\"Place\"},\"type\":\"Organization\"},\"programName\":\"RN to BSN\",\"programType\":\"1 year full time program\",\"programMode\":\"Online\",\"degreeName\":\"Student (RegistrationV1.0)\",\"degreeMajor\":[\"Nursing\",\"Nursing2\"],\"degreeMinor\":[\"Nursing\",\"Nursing\"],\"description\":\"Starfield College’s RN to BSN Online Option allows working nurses to advance your degree in as few as 3 semesters.\\n If you are a registered nurse with an active RN license looking to earn your BSN, Chamberlain's online RN to BSN option can help prepare you for the next step in your career.\\n Our RN to BSN online option allows you to earn your degree while you work.\",\"alignment\":[{\"targetName\":\"Bachelor of Science in Nursing, RN to BSN\",\"targetUrl\":\"https:\\/\\/credentialfinder.org\\/credential\\/5769\\/Bachelor_of_Science_in_Nursing,_RN_to_BSN\",\"targetDescription\":\"The RN to BSN completion program has been developed to address the specific needs of working registered nurses who return to the university to earn the BSN.\",\"targetFramework\":\"Credential Engine's Credential Registry\",\"type\":\"AlignmentObject\"}],\"registrationDate\":\"2011-05\",\"startDate\":\"2011-10\",\"type\":\"EducationDegree\"},\"credentialSchema\":{\"type\":\"JsonSchemaValidator2018\",\"id\":\"https:\\/\\/devlib.velocitynetwork.foundation\\/schemas\\/education-degree-registration-v1.0.schema.json\"},\"offerCreationDate\":\"2022-12-06T11:25:32.955Z\",\"offerExpirationDate\":\"2030-01-01T00:00:00.000Z\",\"offerId\":\"nH6b5jBMJ6XeL1nEk5qNa\",\"id\":\"6578897c770790a0fdff7c97\",\"exchangeId\":\"6578896f770790a0fdff7c8f\",\"hash\":\"6adae30b7023c54929961d9c55e5c5c5c54a4022bea03e74cdfacbdf6380be83\"},{\"type\":[\"EducationDegreeGraduationV1.0\"],\"issuer\":{\"id\":\"did:ion:EiApMLdMb4NPb8sae9-hXGHP79W1gisApVSE80USPEbtJA\"},\"credentialSubject\":{\"@context\":\"https:\\/\\/velocitynetwork.foundation\\/contexts\\/education-degree\",\"institution\":{\"name\":\"University of Massachusetts Amherst ion\",\"identifier\":\"did:ion:EiApMLdMb4NPb8sae9-hXGHP79W1gisApVSE80USPEbtJA\",\"place\":{\"addressLocality\":\"Chicago\",\"addressRegion\":\"US-IL\",\"addressCountry\":\"US\",\"type\":\"Place\"},\"type\":\"Organization\"},\"school\":{\"name\":\"School of nursing (GraduationV1.0)\",\"place\":{\"name\":\"Florida Branch\",\"addressLocality\":\"Fort Myers\",\"addressRegion\":\"US-FL\",\"addressCountry\":\"US\",\"type\":\"Place\"},\"type\":\"Organization\"},\"programName\":\"RN to BSN\",\"programType\":\"1 year full time program\",\"programMode\":\"Online\",\"degreeName\":\"Bachelor of Science (GraduationV1.0)\",\"degreeMajor\":[\"Nursing\",\"Nursing2\"],\"degreeMinor\":[\"Nursing\",\"Nursing2\"],\"description\":\"Starfield College’s RN to BSN Online Option allows working nurses to advance your degree in as few as 3 semesters.\\n If you are a registered nurse with an active RN license looking to earn your BSN, Chamberlain's online RN to BSN option can help prepare you for the next step in your career.\\n Our RN to BSN online option allows you to earn your degree while you work.\",\"alignment\":[{\"targetName\":\"Bachelor of Science in Nursing, RN to BSN\",\"targetUrl\":\"https:\\/\\/credentialfinder.org\\/credential\\/5769\\/Bachelor_of_Science_in_Nursing_RN_to_BSN\",\"targetDescription\":\"The RN to BSN completion program has been developed to address the specific needs of working registered nurses who return to the university to earn the BSN.\",\"targetFramework\":\"Credential Engine's Credential Registry\",\"type\":\"AlignmentObject\"}],\"startDate\":\"2011-08\",\"endDate\":\"2013-06\",\"conferredDate\":\"2014-01\",\"honors\":\"cum laude\",\"type\":\"EducationDegree\"},\"credentialSchema\":{\"type\":\"JsonSchemaValidator2018\",\"id\":\"https:\\/\\/devlib.velocitynetwork.foundation\\/schemas\\/education-degree-graduation-v1.0.schema.json\"},\"offerCreationDate\":\"2022-12-06T11:16:20.136Z\",\"offerExpirationDate\":\"2030-01-01T00:00:00.000Z\",\"offerId\":\"h9tpQcpjbJ19faZr_ySaR\",\"id\":\"6578897c770790a0fdff7c98\",\"exchangeId\":\"6578896f770790a0fdff7c8f\",\"hash\":\"854c1328e55387a500988809a6c7022f5098f5953d38a5795ad2ac285b61f5f1\"}],\"challenge\":\"tGQLKQEhvi-tiXr8\"}"; diff --git a/packages/sdk/test/usecases/GenerateOffersUseCase.test.ts b/packages/sdk/test/usecases/GenerateOffersUseCase.test.ts index 2bfe4f4..af5e748 100644 --- a/packages/sdk/test/usecases/GenerateOffersUseCase.test.ts +++ b/packages/sdk/test/usecases/GenerateOffersUseCase.test.ts @@ -41,7 +41,7 @@ describe("GenerateOffersUseCase Tests", () => { const result = await subject1.generateOffers(CommonMocks.Token, generateOffersDescriptor); const [error, generatedOffers] = result.handleResult(); - expect(generatedOffers?.payload).toStrictEqual(JSON.parse(GenerateOffersMocks.GeneratedOffersJsonObj)); + expect(generatedOffers?.payload).toStrictEqual(GenerateOffersMocks.GeneratedOffersJsonObj); expect(generatedOffers?.all[0]).toStrictEqual(expectedOffer1); expect(generatedOffers?.all[1]).toStrictEqual(expectedOffer2); expect(generatedOffers?.challenge).toBe(GenerateOffersMocks.Challenge); @@ -71,7 +71,7 @@ describe("GenerateOffersUseCase Tests", () => { const result = await subject1.generateOffers(CommonMocks.Token, generateOffersDescriptor); const [error, generatedOffers] = result.handleResult(); - expect(generatedOffers?.payload).toStrictEqual(JSON.parse(GenerateOffersMocks.GeneratedOffersJsonArr)); + expect(generatedOffers?.payload).toStrictEqual(GenerateOffersMocks.GeneratedOffersJsonArr); expect(generatedOffers?.all[0]).toStrictEqual(expectedOffer1); expect(generatedOffers?.all[1]).toStrictEqual(expectedOffer2); expect(generatedOffers?.challenge).toBeNull()