fix signin signout and apply the new style
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import request from 'supertest'
|
||||
import { createApp } from '../../app'
|
||||
|
||||
const app = createApp()
|
||||
|
||||
function uniqueEmail(prefix: string) {
|
||||
return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}@test.com`
|
||||
}
|
||||
|
||||
describe('Company signup API', () => {
|
||||
it('creates new accounts with a 90-day trial period', async () => {
|
||||
const startedAt = Date.now()
|
||||
|
||||
const res = await request(app)
|
||||
.post('/api/v1/auth/company/signup')
|
||||
.send({
|
||||
firstName: 'Trial',
|
||||
lastName: 'Owner',
|
||||
email: uniqueEmail('trial-owner'),
|
||||
password: 'Password123!',
|
||||
companyName: `Trial Cars ${Date.now()}`,
|
||||
legalForm: 'LLC',
|
||||
registrationNumber: `REG-${Date.now()}`,
|
||||
streetAddress: '123 Main Street',
|
||||
city: 'Casablanca',
|
||||
country: 'Morocco',
|
||||
zipCode: '20000',
|
||||
companyPhone: '+212600000000',
|
||||
yearsActive: '1',
|
||||
preferredLanguage: 'en',
|
||||
plan: 'STARTER',
|
||||
billingPeriod: 'MONTHLY',
|
||||
currency: 'MAD',
|
||||
paymentProvider: 'AMANPAY',
|
||||
})
|
||||
|
||||
expect(res.status).toBe(201)
|
||||
|
||||
const trialEndsAt = new Date(res.body.data.trialEndsAt).getTime()
|
||||
const trialDurationDays = (trialEndsAt - startedAt) / (24 * 60 * 60 * 1000)
|
||||
|
||||
expect(trialDurationDays).toBeGreaterThan(89.9)
|
||||
expect(trialDurationDays).toBeLessThan(90.1)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user