forked from jaredhanson/passport-facebook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstrategy.authorizationparams.test.js
51 lines (41 loc) · 1.37 KB
/
strategy.authorizationparams.test.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
var chai = require('chai')
, FacebookStrategy = require('../lib/strategy');
describe('Strategy', function() {
var strategy = new FacebookStrategy({
clientID: 'ABC123',
clientSecret: 'secret'
},
function() {});
describe('handling a request to be redirected with display param', function() {
var url;
before(function(done) {
chai.passport(strategy)
.redirect(function(u) {
url = u;
done();
})
.req(function(req) {
})
.authenticate({ display: 'mobile' });
});
it('should be redirected', function() {
expect(url).to.equal('https://www.facebook.com/dialog/oauth?display=mobile&response_type=code&redirect_uri=&client_id=ABC123&type=web_server');
});
});
describe('handling a request to be redirected with reauthorization params', function() {
var url;
before(function(done) {
chai.passport(strategy)
.redirect(function(u) {
url = u;
done();
})
.req(function(req) {
})
.authenticate({ authType: 'reauthenticate', authNonce: 'foo123' });
});
it('should be redirected', function() {
expect(url).to.equal('https://www.facebook.com/dialog/oauth?auth_type=reauthenticate&auth_nonce=foo123&response_type=code&redirect_uri=&client_id=ABC123&type=web_server');
});
});
});