Skip to content

Commit f08614f

Browse files
committed
Added test for $select=foo/bar
1 parent 669f659 commit f08614f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tests/odata.test.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ describe('cap/samples - Bookshop APIs', () => {
1616
expect(data).to.contain('<Annotation Term="Common.Label" String="Currency"/>')
1717
})
1818

19-
it('serves ListOfBooks?$expand=genre,currency', async () => {
19+
it('serves Books?$expand=genre,currency', async () => {
2020
const Mystery = { name: 'Mystery' }
2121
const Romance = { name: 'Romance' }
2222
const USD = { code: 'USD', name: 'US Dollar', descr: null, symbol: '$' }
23-
const { data } = await GET `/browse/ListOfBooks ${{
23+
const { data } = await GET `/browse/Books ${{
2424
params: { $search: 'Po', $select: `title,author`, $expand:`genre,currency` },
2525
}}`
2626
expect(data.value).to.containSubset([
@@ -29,6 +29,16 @@ describe('cap/samples - Bookshop APIs', () => {
2929
])
3030
})
3131

32+
it('serves Books?$select=genre/name,currency/code', async () => {
33+
const { data } = await GET `/browse/Books ${{
34+
params: { $search: 'Po', $select: `title,author,genre/name,currency/code` },
35+
}}`
36+
expect(data.value).to.containSubset([
37+
{ ID: 251, title: 'The Raven', author: 'Edgar Allen Poe', genre_name:'Mystery', currency_code:'USD' },
38+
{ ID: 252, title: 'Eleonora', author: 'Edgar Allen Poe', genre_name:'Romance', currency_code:'USD' },
39+
])
40+
})
41+
3242
describe('query options...', () => {
3343

3444
it('supports $search in multiple fields', async () => {

0 commit comments

Comments
 (0)