Skip to content

Commit

Permalink
docs(samples): refactor webhook samples (#270)
Browse files Browse the repository at this point in the history
* streamline and clarify webhook samples

Change-Id: I80d80b42f60ac6ccc643afb7b2931916d6843813

* remove sessionInfo config

Change-Id: I1b14852ad9e238e7cdc04dbb418ed5ed0fca2992

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* hardcode parameter

Change-Id: Iea962f2ea2bf73ca86ce3ecd7852a290dd3a2fac

* clarify parameter name

Change-Id: I5c0a1c654be5133889f4838a118e5bdebe667303

* refactor configure-session-parameter-enable-agent-response sample

Change-Id: I62af853767f9097e3448f60060f739ac8bb018b2

* refactor webhook samples

Change-Id: I07f2addae8b452d89124d123e3c2be8042ee0292

* remove unnecessary samples

Change-Id: Ia936ce14eafb9d44a67a314eb282fb93b5c96319

* change form parameter test

Change-Id: Ia7aeb8117f6db4bee2111bdb5bcf6461b2700601

* change sample description

Change-Id: I842e1e0bca1eec43d5437cd37575a43b48105bed

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and Ace Nassri committed Nov 17, 2022
1 parent 061d3d2 commit 652a6d5
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 383 deletions.

This file was deleted.

25 changes: 2 additions & 23 deletions dialogflow-cx/test/webhook-configure-session-parameters-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('configure session parameters', () => {
const request = {
body: {
fulfillmentInfo: {
tag: 'month',
tag: 'configure-session-parameter',
},
},
};
Expand All @@ -53,27 +53,6 @@ describe('configure session parameters', () => {
};

webhook.configureSessionParams(JSON.parse(temp), res);
assert.include(response, 'January');
});

it('should test that webhook configures session parameter', async () => {
const request = {
body: {
fulfillmentInfo: {
tag: 'year',
},
},
};
const temp = JSON.stringify(request);
let response = '';

const res = {
send: function (s) {
response = JSON.stringify(s);
},
};

webhook.configureSessionParams(JSON.parse(temp), res);
assert.include(response, '1999');
assert.include(response, 'orderNumber');
});
});

This file was deleted.

46 changes: 1 addition & 45 deletions dialogflow-cx/test/webhook-validate-form-parameter-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,55 +35,11 @@ const {describe, it} = require('mocha');
const webhook = require('../webhook-validate-form-parameter');

describe('configure session parameters', () => {
it('should test that webhook validates form parameter', async () => {
const number = 4;
const request = {
body: {
fulfillmentInfo: {
tag: 'valid-parameter',
},
pageInfo: {
formInfo: {
parameterInfo: [
{
displayName: 'number',
value: number,
},
],
},
},
},
};
const temp = JSON.stringify(request);
let response = '';

const res = {
send: function (s) {
response = JSON.stringify(s);
},
};

webhook.validateParameter(JSON.parse(temp), res);
assert.include(response, 'VALID');
});

it('should test that webhook invalidates form parameter', async () => {
const number = 150;
const request = {
body: {
fulfillmentInfo: {
tag: 'invalid-parameter',
},
pageInfo: {
formInfo: {
parameterInfo: [
{
displayName: 'number',
required: true,
value: number,
},
],
},
tag: 'invalidate-form-parameter',
},
},
};
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 652a6d5

Please sign in to comment.