1
0
Fork 0
freesewing/sites/backend/tests/index.mjs

42 lines
1 KiB
JavaScript
Raw Normal View History

2022-11-07 19:06:58 +01:00
import dotenv from 'dotenv'
import chai from 'chai'
import http from 'chai-http'
import { verifyConfig } from '../src/config.mjs'
import { randomString } from '../src/utils/crypto.mjs'
import { userTests } from './user.mjs'
import { accountTests } from './account.mjs'
2022-11-07 19:06:58 +01:00
import { apikeyTests } from './apikey.mjs'
import { setup } from './shared.mjs'
dotenv.config()
const config = verifyConfig()
const expect = chai.expect
chai.use(http)
// Account data
const store = {
account: {
email: `test_${randomString()}@${config.tests.domain}`,
language: 'en',
password: randomString(),
},
2022-11-07 19:50:51 +01:00
icons: {
user: '🧑 ',
jwt: '🎫 ',
key: '🎟️ ',
},
2022-11-07 19:06:58 +01:00
}
2022-11-07 19:50:51 +01:00
store.icon = (icon1, icon2 = false) => store.icons[icon1] + (icon2 ? store.icons[icon2] : '')
2022-11-07 19:06:58 +01:00
// Run tests
const runTests = async (config, store, chai) => {
await setup(config, store, chai)
await userTests(config, store, chai)
//await apikeyTests(config, store, chai)
//await accountTests(config, store, chai)
2022-11-07 19:06:58 +01:00
}
// Do the work
runTests(config, store, chai)