Skip to content

Commit

Permalink
chore: test
Browse files Browse the repository at this point in the history
  • Loading branch information
nlunets committed Jun 16, 2023
1 parent 9b3feda commit 06c4b67
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export class ODataV4ObjectRequest<T> extends ODataRequest<T> {
targetPath: string,
protected objectKey: ODataKey = {},
protected method: string = 'GET',
protected headers: Record<string, string> = {}
public headers: Record<string, string> = {}
) {
super(odataRootUri, targetPath);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ module.exports = {
case 'boundActionReturnsVoid':
return undefined;
case 'baseFunction':
if (odataRequest.isStrictMode) {
return `STRICT :: ${actionData.data}`;
}
return actionData.data;
default:
this.throwError('Not implemented', 501, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"ID": 1,
"Prop1": "SomethingElse",
"Prop1": "First Prop",
"Prop2": "Second Prop",
"isBoundAction1Hidden": false,
"isBoundAction2Hidden": false,
Expand Down
13 changes: 13 additions & 0 deletions packages/fe-mockserver-core/test/unit/middleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ describe('V4 Requestor', function () {
)
.execute('GET');
expect(dataRes).toMatchInlineSnapshot(`"I am data"`);
const dataResStrict = dataRequestor.callGETAction(
"/RootElement(ID=1,IsActiveEntity=true)/sap.fe.core.ActionVisibility.baseFunction(data='I am data')"
);
dataResStrict.headers['Prefer'] = 'handling=strict';
const strictResult = await dataResStrict.execute('GET');
expect(strictResult).toMatchInlineSnapshot(`"STRICT :: I am data"`);
const dataRes2 = await dataRequestor
.callGETAction('/RootElement(ID=1,IsActiveEntity=true)/_Elements')
.execute('GET');
Expand Down Expand Up @@ -350,4 +356,11 @@ describe('V4 Requestor', function () {
myJSON[0].Prop1 = 'First Prop';
fs.writeFileSync(path.join(__dirname, '__testData', 'RootElement.json'), JSON.stringify(myJSON, null, 4));
});
afterAll(() => {
const myJSON = JSON.parse(
fs.readFileSync(path.join(__dirname, '__testData', 'RootElement.json')).toString('utf-8')
);
myJSON[0].Prop1 = 'First Prop';
fs.writeFileSync(path.join(__dirname, '__testData', 'RootElement.json'), JSON.stringify(myJSON, null, 4));
});
});

0 comments on commit 06c4b67

Please sign in to comment.