1
0
Fork 0
freesewing/sites/backend/tests/admin.test.js

32 lines
785 B
JavaScript
Raw Normal View History

module.exports = function tests(store, config, chai) {
describe('Admin routes', () => {
2022-09-15 13:49:55 +02:00
it('should login ad admin', (done) => {
chai
.request(config.backend)
.post('/login')
.send({
username: 'admin',
2022-09-15 13:49:55 +02:00
password: 'admin',
})
.end((err, res) => {
console.log(res)
res.should.have.status(200)
done()
})
})
2022-09-15 13:49:55 +02:00
it('should load a user account', (done) => {
chai
.request(config.backend)
.get('/admin/users/rracx')
.set('Authorization', 'Bearer ' + config.user.token)
.end((err, res) => {
res.should.have.status(200)
let data = JSON.parse(res.text)
console.log(data)
done()
})
})
})
}