Merge branch 'main' into feat-build-quests

This commit is contained in:
Chen, Tai-Lin committed 2023-11-17 15:12:32 +08:00
commit 0ac1dbed96
24 files changed
+702 -68

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
import { User } from '@linux-odyssey/models'
import config from '../config.js'
import { createUser } from '../models/userManager.js'
export default async function setupTest() {
console.log('Setting up test account')
if (!(config.testing.username && config.testing.password)) {
throw new Error(
'No testing account found! Please set TESTING_USERNAME and TESTING_PASSWORD in .env'
)
}
const { username, password } = config.testing
const email = `${username}@example.com`
if (await User.exists({ username })) {
console.log('Testing account already exists')
return
}
await createUser(username, email, password)
console.log('Created testing account')
}