Skip to content

Commit

Permalink
test: add a test case for appendAdditionalUserAgent in ask-sdk-core (#…
Browse files Browse the repository at this point in the history
…627)

Co-authored-by: Hidetaka Okamoto <info@wp-kyoto.net>
  • Loading branch information
hideokamoto and Hidetaka Okamoto committed May 18, 2020
1 parent 3243768 commit 8324256
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions ask-sdk-core/tst/skill/CustomSkill.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,24 @@ describe('CustomSkill', () => {
expect(skill.supports({} as any)).eq(false);
});

it('should be able to append additional user agent', async() => {
const additionUserAnger : string = 'TEST_Agent';
const packageInfo = require('../../package.json');
const skill = SkillBuilders.custom()
.withCustomUserAgent('custom')
.addRequestHandlers(
new MockAlwaysTrueRequestHandler(),
new MockAlwaysFalseRequestHandler(),
)
.create();

const requestEnvelope = JsonProvider.requestEnvelope();
skill.appendAdditionalUserAgent(additionUserAnger);
const responseEnvelope = await skill.invoke(requestEnvelope);

expect(responseEnvelope.userAgent).equal(`ask-node/${packageInfo.version} Node/${process.version} custom ${additionUserAnger}`);
});

it('should be able to append additional user agent', async() => {
const additionUserAnger : string = 'TEST_Agent';
const packageInfo = require('../../package.json');
Expand Down

0 comments on commit 8324256

Please sign in to comment.