Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit 3adeee8

Browse files
committed
change tests
1 parent a7794a4 commit 3adeee8

File tree

4 files changed

+217
-187
lines changed

4 files changed

+217
-187
lines changed

media-store/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"scripts": {
2424
"start": "npx cds run",
2525
"deploy": "cds deploy --to sqlite:mychinook.db",
26-
"test": "npm run deploy && cd ../ && npm run jest"
26+
"test": "mocha test/media-store.test.js --verbose --timeout 10000"
2727
},
2828
"cds": {
2929
"ACCESS_TOKEN_SECRET": "secret",

media-store/srv/browse-invoices-service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ module.exports = async function () {
8181
INSERT.into(InvoiceItems)
8282
.columns("ID", "invoice_ID", "track_ID", "unitPrice")
8383
.rows(
84-
tracks.map(({ ID: trackID, unitPrice }, index) => [
84+
newInvoicedTracks.map(({ ID: trackID, unitPrice }, index) => [
8585
lastInvoiceItemId + index + 1,
8686
newInvoiceId,
8787
trackID,

media-store/test/data/media-store.mock.js

Lines changed: 0 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -21,170 +21,6 @@ const FIRST_TRACK = {
2121
},
2222
};
2323

24-
const ALL_ALBUMS_WITH_TRACKS_BY_ARTIST = {
25-
"@odata.context": "$metadata#Albums(tracks())",
26-
value: [
27-
{
28-
ID: 1,
29-
title: "For Those About To Rock We Salute You",
30-
artist_ID: 1,
31-
tracks: [
32-
{
33-
ID: 1,
34-
name: "For Those About To Rock (We Salute You)",
35-
composer: "Angus Young, Malcolm Young, Brian Johnson",
36-
unitPrice: 0.99,
37-
album_ID: 1,
38-
genre_ID: 1,
39-
},
40-
{
41-
ID: 6,
42-
name: "Put The Finger On You",
43-
composer: "Angus Young, Malcolm Young, Brian Johnson",
44-
unitPrice: 0.99,
45-
album_ID: 1,
46-
genre_ID: 1,
47-
},
48-
{
49-
ID: 7,
50-
name: "Let's Get It Up",
51-
composer: "Angus Young, Malcolm Young, Brian Johnson",
52-
unitPrice: 0.99,
53-
album_ID: 1,
54-
genre_ID: 1,
55-
},
56-
{
57-
ID: 8,
58-
name: "Inject The Venom",
59-
composer: "Angus Young, Malcolm Young, Brian Johnson",
60-
unitPrice: 0.99,
61-
album_ID: 1,
62-
genre_ID: 1,
63-
},
64-
{
65-
ID: 9,
66-
name: "Snowballed",
67-
composer: "Angus Young, Malcolm Young, Brian Johnson",
68-
unitPrice: 0.99,
69-
album_ID: 1,
70-
genre_ID: 1,
71-
},
72-
{
73-
ID: 10,
74-
name: "Evil Walks",
75-
composer: "Angus Young, Malcolm Young, Brian Johnson",
76-
unitPrice: 0.99,
77-
album_ID: 1,
78-
genre_ID: 1,
79-
},
80-
{
81-
ID: 11,
82-
name: "C.O.D.",
83-
composer: "Angus Young, Malcolm Young, Brian Johnson",
84-
unitPrice: 0.99,
85-
album_ID: 1,
86-
genre_ID: 1,
87-
},
88-
{
89-
ID: 12,
90-
name: "Breaking The Rules",
91-
composer: "Angus Young, Malcolm Young, Brian Johnson",
92-
unitPrice: 0.99,
93-
album_ID: 1,
94-
genre_ID: 1,
95-
},
96-
{
97-
ID: 13,
98-
name: "Night Of The Long Knives",
99-
composer: "Angus Young, Malcolm Young, Brian Johnson",
100-
unitPrice: 0.99,
101-
album_ID: 1,
102-
genre_ID: 1,
103-
},
104-
{
105-
ID: 14,
106-
name: "Spellbound",
107-
composer: "Angus Young, Malcolm Young, Brian Johnson",
108-
unitPrice: 0.99,
109-
album_ID: 1,
110-
genre_ID: 1,
111-
},
112-
],
113-
},
114-
{
115-
ID: 4,
116-
title: "Let There Be Rock",
117-
artist_ID: 1,
118-
tracks: [
119-
{
120-
ID: 15,
121-
name: "Go Down",
122-
composer: "AC/DC",
123-
unitPrice: 0.99,
124-
album_ID: 4,
125-
genre_ID: 1,
126-
},
127-
{
128-
ID: 16,
129-
name: "Dog Eat Dog",
130-
composer: "AC/DC",
131-
unitPrice: 0.99,
132-
album_ID: 4,
133-
genre_ID: 1,
134-
},
135-
{
136-
ID: 17,
137-
name: "Let There Be Rock",
138-
composer: "AC/DC",
139-
unitPrice: 0.99,
140-
album_ID: 4,
141-
genre_ID: 1,
142-
},
143-
{
144-
ID: 18,
145-
name: "Bad Boy Boogie",
146-
composer: "AC/DC",
147-
unitPrice: 0.99,
148-
album_ID: 4,
149-
genre_ID: 1,
150-
},
151-
{
152-
ID: 19,
153-
name: "Problem Child",
154-
composer: "AC/DC",
155-
unitPrice: 0.99,
156-
album_ID: 4,
157-
genre_ID: 1,
158-
},
159-
{
160-
ID: 20,
161-
name: "Overdose",
162-
composer: "AC/DC",
163-
unitPrice: 0.99,
164-
album_ID: 4,
165-
genre_ID: 1,
166-
},
167-
{
168-
ID: 21,
169-
name: "Hell Ain't A Bad Place To Be",
170-
composer: "AC/DC",
171-
unitPrice: 0.99,
172-
album_ID: 4,
173-
genre_ID: 1,
174-
},
175-
{
176-
ID: 22,
177-
name: "Whole Lotta Rosie",
178-
composer: "AC/DC",
179-
unitPrice: 0.99,
180-
album_ID: 4,
181-
genre_ID: 1,
182-
},
183-
],
184-
},
185-
],
186-
};
187-
18824
const SECOND_CUSTOMER = {
18925
"@odata.context": "$metadata#Customers/$entity",
19026
ID: 2,
@@ -266,7 +102,6 @@ const SECOND_CUSTOMER_INVOICES = {
266102

267103
module.exports = {
268104
FIRST_TRACK,
269-
ALL_ALBUMS_WITH_TRACKS_BY_ARTIST,
270105
SECOND_CUSTOMER,
271106
FOURTH_MARKED_TRACK_FOR_SECOND_CUSTOMER,
272107
SECOND_CUSTOMER_INVOICES,

0 commit comments

Comments
 (0)