@@ -11,6 +11,6 @@ service CatalogService @(path:'/browse') {
|
|||||||
} excluding { createdBy, modifiedBy };
|
} excluding { createdBy, modifiedBy };
|
||||||
|
|
||||||
@requires: 'authenticated-user'
|
@requires: 'authenticated-user'
|
||||||
action submitOrder ( book: Books:ID, amount: Integer ) returns { stock: Integer };
|
action submitOrder ( book: Books:ID, quantity: Integer ) returns { stock: Integer };
|
||||||
event OrderedBook : { book: Books:ID; amount: Integer; buyer: String };
|
event OrderedBook : { book: Books:ID; quantity: Integer; buyer: String };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,19 @@ GET {{server}}/admin/Authors?
|
|||||||
# &sap-language=de
|
# &sap-language=de
|
||||||
Authorization: Basic alice:
|
Authorization: Basic alice:
|
||||||
|
|
||||||
|
### ------------------------------------------------------------------------
|
||||||
|
# Create Author
|
||||||
|
POST {{server}}/admin/Authors
|
||||||
|
Content-Type: application/json;IEEE754Compatible=true
|
||||||
|
Authorization: Basic alice:
|
||||||
|
|
||||||
|
{
|
||||||
|
"ID": 112,
|
||||||
|
"name": "Shakespeeeeere",
|
||||||
|
"age": 22
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
### ------------------------------------------------------------------------
|
### ------------------------------------------------------------------------
|
||||||
# Create book
|
# Create book
|
||||||
POST {{server}}/admin/Books
|
POST {{server}}/admin/Books
|
||||||
|
|||||||
@@ -11,39 +11,39 @@ describe('Localized Data', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('supports sap-language param', async () => {
|
it('supports sap-language param', async () => {
|
||||||
const { data } = await GET(`/browse/Books?$select=title,authorName` + '&sap-language=de')
|
const { data } = await GET(`/browse/Books?$select=title,author` + '&sap-language=de')
|
||||||
expect(data.value).to.containSubset([
|
expect(data.value).to.containSubset([
|
||||||
{ title: 'Sturmhöhe', authorName: 'Emily Brontë' },
|
{ title: 'Sturmhöhe', author: 'Emily Brontë' },
|
||||||
{ title: 'Jane Eyre', authorName: 'Charlotte Brontë' },
|
{ title: 'Jane Eyre', author: 'Charlotte Brontë' },
|
||||||
{ title: 'The Raven', authorName: 'Edgar Allen Poe' },
|
{ title: 'The Raven', author: 'Edgar Allen Poe' },
|
||||||
{ title: 'Eleonora', authorName: 'Edgar Allen Poe' },
|
{ title: 'Eleonora', author: 'Edgar Allen Poe' },
|
||||||
{ title: 'Catweazle', authorName: 'Richard Carpenter' },
|
{ title: 'Catweazle', author: 'Richard Carpenter' },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('supports accept-language header', async () => {
|
it('supports accept-language header', async () => {
|
||||||
const { data } = await GET(`/browse/Books?$select=title,authorName`, {
|
const { data } = await GET(`/browse/Books?$select=title,author`, {
|
||||||
headers: { 'Accept-Language': 'de' },
|
headers: { 'Accept-Language': 'de' },
|
||||||
})
|
})
|
||||||
expect(data.value).to.containSubset([
|
expect(data.value).to.containSubset([
|
||||||
{ title: 'Sturmhöhe', authorName: 'Emily Brontë' },
|
{ title: 'Sturmhöhe', author: 'Emily Brontë' },
|
||||||
{ title: 'Jane Eyre', authorName: 'Charlotte Brontë' },
|
{ title: 'Jane Eyre', author: 'Charlotte Brontë' },
|
||||||
{ title: 'The Raven', authorName: 'Edgar Allen Poe' },
|
{ title: 'The Raven', author: 'Edgar Allen Poe' },
|
||||||
{ title: 'Eleonora', authorName: 'Edgar Allen Poe' },
|
{ title: 'Eleonora', author: 'Edgar Allen Poe' },
|
||||||
{ title: 'Catweazle', authorName: 'Richard Carpenter' },
|
{ title: 'Catweazle', author: 'Richard Carpenter' },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('supports queries with $expand', async () => {
|
it('supports queries with $expand', async () => {
|
||||||
const { data } = await GET(`/browse/Books?&$select=title,authorName&$expand=currency`, {
|
const { data } = await GET(`/browse/Books?&$select=title,author&$expand=currency`, {
|
||||||
headers: { 'Accept-Language': 'de' },
|
headers: { 'Accept-Language': 'de' },
|
||||||
})
|
})
|
||||||
expect(data.value).to.containSubset([
|
expect(data.value).to.containSubset([
|
||||||
{ title: 'Sturmhöhe', authorName: 'Emily Brontë', currency: { name: 'Pfund' } },
|
{ title: 'Sturmhöhe', author: 'Emily Brontë', currency: { name: 'Pfund' } },
|
||||||
{ title: 'Jane Eyre', authorName: 'Charlotte Brontë', currency: { name: 'Pfund' } },
|
{ title: 'Jane Eyre', author: 'Charlotte Brontë', currency: { name: 'Pfund' } },
|
||||||
{ title: 'The Raven', authorName: 'Edgar Allen Poe', currency: { name: 'US-Dollar' } },
|
{ title: 'The Raven', author: 'Edgar Allen Poe', currency: { name: 'US-Dollar' } },
|
||||||
{ title: 'Eleonora', authorName: 'Edgar Allen Poe', currency: { name: 'US-Dollar' } },
|
{ title: 'Eleonora', author: 'Edgar Allen Poe', currency: { name: 'US-Dollar' } },
|
||||||
{ title: 'Catweazle', authorName: 'Richard Carpenter', currency: { name: 'Yen' } },
|
{ title: 'Catweazle', author: 'Richard Carpenter', currency: { name: 'Yen' } },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -19,13 +19,13 @@ describe('OData Protocol', () => {
|
|||||||
|
|
||||||
it('supports $search in multiple fields', async () => {
|
it('supports $search in multiple fields', async () => {
|
||||||
const { data } = await GET `/browse/Books ${{
|
const { data } = await GET `/browse/Books ${{
|
||||||
params: { $search: 'Po', $select: `title,authorName` },
|
params: { $search: 'Po', $select: `title,author` },
|
||||||
}}`
|
}}`
|
||||||
expect(data.value).to.eql([
|
expect(data.value).to.eql([
|
||||||
{ ID: 201, title: 'Wuthering Heights', authorName: 'Emily Brontë' },
|
{ ID: 201, title: 'Wuthering Heights', author: 'Emily Brontë' },
|
||||||
{ ID: 207, title: 'Jane Eyre', authorName: 'Charlotte Brontë' },
|
{ ID: 207, title: 'Jane Eyre', author: 'Charlotte Brontë' },
|
||||||
{ ID: 251, title: 'The Raven', authorName: 'Edgar Allen Poe' },
|
{ ID: 251, title: 'The Raven', author: 'Edgar Allen Poe' },
|
||||||
{ ID: 252, title: 'Eleonora', authorName: 'Edgar Allen Poe' },
|
{ ID: 252, title: 'Eleonora', author: 'Edgar Allen Poe' },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user