Skip to content

Commit 5c3a130

Browse files
committed
Update tests for secret->protected rename
1 parent 9764a28 commit 5c3a130

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

test/test-secret.js renamed to test/test-protected.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const expect = chai.expect;
1616
chai.use(chaiHttp);
1717

1818

19-
describe('Auth endpoints', function() {
19+
describe('Protected endpoint', function() {
2020
const username = 'exampleUser';
2121
const password = 'examplePass';
2222
const firstName = 'Example';
@@ -45,10 +45,10 @@ describe('Auth endpoints', function() {
4545
return User.remove({});
4646
});
4747

48-
describe('/api/secret', function() {
48+
describe('/api/protected', function() {
4949
it('Should reject requests with no credentials', function() {
5050
return chai.request(app)
51-
.get('/api/secret')
51+
.get('/api/protected')
5252
.then(() => expect.fail(null, null, 'Request should not succeed'))
5353
.catch(err => {
5454
if (err instanceof chai.AssertionError) {
@@ -71,7 +71,7 @@ describe('Auth endpoints', function() {
7171
});
7272

7373
return chai.request(app)
74-
.get('/api/secret')
74+
.get('/api/protected')
7575
.set('Authorization', `Bearer ${token}`)
7676
.then(() => expect.fail(null, null, 'Request should not succeed'))
7777
.catch(err => {
@@ -97,7 +97,7 @@ describe('Auth endpoints', function() {
9797
});
9898

9999
return chai.request(app)
100-
.get('/api/secret')
100+
.get('/api/protected')
101101
.set('authorization', `Bearer ${token}`)
102102
.then(() => expect.fail(null, null, 'Request should not succeed'))
103103
.catch(err => {
@@ -109,7 +109,7 @@ describe('Auth endpoints', function() {
109109
expect(res).to.have.status(401);
110110
});
111111
});
112-
it('Should send a secret', function() {
112+
it('Should send protected data', function() {
113113
const token = jwt.sign({
114114
user: {
115115
username,
@@ -123,12 +123,12 @@ describe('Auth endpoints', function() {
123123
});
124124

125125
return chai.request(app)
126-
.get('/api/secret')
126+
.get('/api/protected')
127127
.set('authorization', `Bearer ${token}`)
128128
.then(res => {
129129
expect(res).to.have.status(200);
130130
expect(res.body).to.be.an('object');
131-
expect(res.body.secret).to.equal('rosebud');
131+
expect(res.body.data).to.equal('rosebud');
132132
});
133133
});
134134
});

0 commit comments

Comments
 (0)