From 14002300c5dcc8f2e8af53a553640a2727f54f31 Mon Sep 17 00:00:00 2001 From: Daniel Hutzel Date: Mon, 3 May 2021 21:05:27 +0200 Subject: [PATCH 1/5] Rename index.cds to services.cds --- bookshop/app/{index.cds => services.cds} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename bookshop/app/{index.cds => services.cds} (100%) diff --git a/bookshop/app/index.cds b/bookshop/app/services.cds similarity index 100% rename from bookshop/app/index.cds rename to bookshop/app/services.cds From 702c3245bdd250c82c7b4af227318816741a33d0 Mon Sep 17 00:00:00 2001 From: Christian Georgi Date: Mon, 10 May 2021 10:29:33 +0200 Subject: [PATCH 2/5] Fix broken translation UI Use `Books.texts` instead of `_texts`, requiring sap/cds 5 --- fiori/app/admin/fiori-service.cds | 4 ++-- fiori/package.json | 2 +- orders/package.json | 2 +- reviews/package.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fiori/app/admin/fiori-service.cds b/fiori/app/admin/fiori-service.cds index 8e97fdbe..d1c2b50a 100644 --- a/fiori/app/admin/fiori-service.cds +++ b/fiori/app/admin/fiori-service.cds @@ -70,7 +70,7 @@ annotate AdminService.Authors with @( annotate sap.capire.bookshop.Books with @fiori.draft.enabled; annotate AdminService.Books with @odata.draft.enabled; -annotate AdminService.Books_texts with @( +annotate AdminService.Books.texts with @( UI: { Identification: [{Value:title}], SelectionFields: [ locale, title ], @@ -83,7 +83,7 @@ annotate AdminService.Books_texts with @( ); // Add Value Help for Locales -annotate AdminService.Books_texts { +annotate AdminService.Books.texts { locale @ValueList:{entity:'Languages',type:#fixed} } // In addition we need to expose Languages through AdminService diff --git a/fiori/package.json b/fiori/package.json index 414541d3..2e4e62cf 100644 --- a/fiori/package.json +++ b/fiori/package.json @@ -6,7 +6,7 @@ "@capire/reviews": "*", "@capire/orders": "*", "@capire/common": "*", - "@sap/cds": ">=4", + "@sap/cds": "^5", "express": "^4.17.1", "passport": "^0.4.1" }, diff --git a/orders/package.json b/orders/package.json index 87cd62cd..7415f469 100644 --- a/orders/package.json +++ b/orders/package.json @@ -2,6 +2,6 @@ "name": "@capire/orders", "version": "1.0.0", "dependencies": { - "@sap/cds": ">=4.3.0" + "@sap/cds": "^5" } } \ No newline at end of file diff --git a/reviews/package.json b/reviews/package.json index 746d279e..b91edfba 100644 --- a/reviews/package.json +++ b/reviews/package.json @@ -7,7 +7,7 @@ "index.cds" ], "dependencies": { - "@sap/cds": ">=4", + "@sap/cds": "^5", "express": "^4.17.1" }, "scripts": { From ff3801be7154c87e5c38f9f0e5f4d4d301ad863b Mon Sep 17 00:00:00 2001 From: d049904 Date: Wed, 12 May 2021 12:41:31 +0200 Subject: [PATCH 3/5] Avoid race condition --- test/custom-handlers.test.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/test/custom-handlers.test.js b/test/custom-handlers.test.js index f8541a18..80b9ed71 100644 --- a/test/custom-handlers.test.js +++ b/test/custom-handlers.test.js @@ -6,13 +6,9 @@ else cds.User = cds.User.Privileged // hard core monkey patch for older cds rele describe('Custom Handlers', () => { it('should reject out-of-stock orders', async () => { - await expect( - Promise.all([ - POST('/browse/submitOrder', { book: 201, amount: 5 }), - POST('/browse/submitOrder', { book: 201, amount: 5 }), - POST('/browse/submitOrder', { book: 201, amount: 5 }), - ]) - ).to.be.rejectedWith(/409 - 5 exceeds stock for book #201/) + await POST('/browse/submitOrder', { book: 201, amount: 5 }) + await POST('/browse/submitOrder', { book: 201, amount: 5 }) + await expect(POST('/browse/submitOrder', { book: 201, amount: 5 })).to.be.rejectedWith(/409 - 5 exceeds stock for book #201/) const { data } = await GET`/admin/Books/201/stock/$value` expect(data).to.equal(2) }) From 3117df12825e99765c8f1f4509cddcafc71789ca Mon Sep 17 00:00:00 2001 From: Christian Georgi Date: Fri, 28 May 2021 14:54:43 +0200 Subject: [PATCH 4/5] Test with Jest 26 `cds.test` seems to have issues w/ Jest 27. To be investigated... --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d8b32c62..1eae7227 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "fiori": "cds watch fiori", "media": "cds watch media", "mocha": "npx mocha || echo", - "jest": "npx jest", + "jest": "npx jest@^26", "test": "npm run jest --silent" }, "mocha": { From be87f5617aea2d710401c7dfcbadb4caf98d8ae5 Mon Sep 17 00:00:00 2001 From: Pierre Fritsch Date: Fri, 28 May 2021 12:02:11 +0200 Subject: [PATCH 5/5] Fix typo orderd -> ordered --- bookshop/app/vue/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookshop/app/vue/app.js b/bookshop/app/vue/app.js index 78bd342b..f99d87a8 100644 --- a/bookshop/app/vue/app.js +++ b/bookshop/app/vue/app.js @@ -35,7 +35,7 @@ const books = new Vue ({ try { const res = await POST(`/submitOrder`, { amount, book: book.ID }) book.stock = res.data.stock - books.order = { amount, succeeded: `Successfully orderd ${amount} item(s).` } + books.order = { amount, succeeded: `Successfully ordered ${amount} item(s).` } } catch (e) { books.order = { amount, failed: e.response.data.error.message } }