Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should return an object with LiveApiToken', async function() {
const response = await frost.create()
const apiToken = await frost.createApiToken(response.token, Network.LIVE)
expect(apiToken).to.be.an('object')
expect(apiToken.apiToken.slice(0, 5)).to.not.eq('TEST_')
expect(apiToken).to.have.all.keys('apiToken')
})
})
it(`should return a login token`, async function() {
await frost.create()
const { token } = await getDataVerifiedAccount(mail)
const verify = await frost.verifyAccount(token)
expect(verify.token).to.be.a('string')
})
})
it(`should return a message with '${errorMessages.accountNotFound}'`, async function() {
await expect(frost.sendEmailForgotPassword('email@exist.com')).to.be.throwWith(errorMessages.accountNotFound)
})
})
it('should return an email verified', async function() {
await frost.create()
const [message] = await mail.getEmails()
expect(message.subject).to.eq('Po.et Verify account')
expect(message.from[0].name).to.eq('Po.et')
})
})
it('Should not be able to log in with the old password', async function() {
await createUserVerified(mail, frost)
await mail.removeAll()
await frost.sendEmailForgotPassword()
const token = await getTokenResetPassword(mail)
await frost.changePasswordWithToken(token, newPassword)
await expect(frost.login(email, password)).to.be.throwWith(errorMessages.accountNotFound)
})
})
it(`should return an error with '${errorMessages.maximumTokens}'`, async function() {
const response = await frost.create()
const maxTokens = 5
for (let i = 1; i <= maxTokens - 1; i++) await frost.createApiToken(response.token, Network.TEST)
await expect(frost.createApiToken(response.token, Network.TEST)).to.be.throwWith(errorMessages.maximumTokens)
})
})
it(`should return an error message with 'One of the inputs is not valid...'`, async function() {
await expect(frost.create(email, feature.value)).to.be.throwWith(errorMessages.inputsNotValid)
})
})
it(`Should send error message with '${errorMessages.accountIsNotVerified}'`, async function() {
const response = await frost.create()
const { apiToken } = await frost.createApiToken(response.token, Network.LIVE)
await expect(frost.getWorks(apiToken)).to.be.throwWith(errorMessages.accountIsNotVerified)
})
})
it('should return OK', async function() {
const { token } = await frost.create()
const { apiTokens } = await frost.getApiTokens(token)
const response = await frost.removeApiToken(token, apiTokens[0])
expect(response).to.eql('OK')
})
})
it('should return an email verified', async function() {
await frost.create()
const [message] = await mail.getEmails()
expect(message.subject).to.eq('Po.et Verify account')
expect(message.from[0].name).to.eq('Po.et')
})
})