-
Notifications
You must be signed in to change notification settings - Fork 116
/
test-examples-server-verification.js
77 lines (67 loc) · 2.06 KB
/
test-examples-server-verification.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*jshint expr: true*/
"use strict";
var chai = require("chai");
var expect = chai.expect;
chai.config.includeStack = true;
var request = require("supertest");
var alexaAppServer = require("../index");
var fs = require("fs");
var utils = require("../utils");
describe("Alexa App Server with Examples & Verification", function() {
var testServer;
var sampleLaunchReq;
before(function() {
testServer = alexaAppServer.start({
port: 3000,
server_root: 'examples',
debug: false,
verify: true
});
sampleLaunchReq = utils.readJsonFile("test/sample-launch-req.json");
});
after(function() {
testServer.stop();
});
describe("GET requests", function() {
it("mounts hello world app", function() {
return request(testServer.express)
.get('/alexa/hello_world')
.expect(401);
});
it("mounts number_guessing_game app", function() {
return request(testServer.express)
.get('/alexa/number_guessing_game')
.expect(401);
});
});
describe("POST requests", function() {
it("mounts hello world app", function() {
return request(testServer.express)
.post('/alexa/hello_world')
.send(sampleLaunchReq)
.expect(401);
});
it("mounts number_guessing_game", function() {
return request(testServer.express)
.post('/alexa/number_guessing_game')
.send(sampleLaunchReq)
.expect(401);
});
it("invokes verifier number_guessing_game", function() {
return request(testServer.express)
.post('/alexa/number_guessing_game')
.set('signaturecertchainurl', 'dummy-signature-chain-url')
.set('signature', 'dummy-signature')
.send(sampleLaunchReq)
.expect(401);
});
it("invokes verifier number_guessing_game", function() {
return request(testServer.express)
.post('/alexa/number_guessing_game')
.set('signaturecertchainurl', 'dummy-signature-chain-url')
.set('signature', 'dummy-signature')
.send(sampleLaunchReq)
.expect(401);
});
});
});