totpauth-model/spec/user.spec.ts

29 lines
789 B
TypeScript

import { initUser } from "../src/tokenMan"
import { User } from "../src/user.model"
const userTest = async()=>{
try{
const newUser = await initUser({
name:"Raegar Targaryen",
email: "raegar@targaryens.dyn",
})
throw new Error("I was expecting this to fail")
}catch(e){
if(e.message == "I was expecting this to fail"){
throw new Error("I was expecting this to fail")
}
}
const newUser2 = await initUser({
name:"Phillip Thern",
email: "phillip.nicholas@thern.wtf"
})
const rebuildUser = await User.buildUser({
name: newUser2.name,
email: newUser2.email,
secret: newUser2.secret
})
console.log(rebuildUser)
}
userTest()