working buytoken (untested)
This commit is contained in:
+21
-10
@@ -60,6 +60,12 @@ const testAccounts : protoAccount[] = [
|
||||
race: 'Night Elf',
|
||||
spec: 'Protection',
|
||||
rank: 'Officer'
|
||||
},{
|
||||
name: 'Silver',
|
||||
class: 'Druid',
|
||||
race: 'Night Elf',
|
||||
spec: 'Restoration',
|
||||
rank: 'Raider'
|
||||
},{
|
||||
name: 'Dagger',
|
||||
race: 'Dwarf',
|
||||
@@ -117,7 +123,7 @@ describe('Frontcraft', () => {
|
||||
const account = await createAccount({
|
||||
pwhash: 'ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb', //sha256("a")
|
||||
rank: acc.rank,
|
||||
username: acc.name
|
||||
username: acc.name,
|
||||
})
|
||||
const auth = await client.UserManager.login(acc.name, 'ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb')
|
||||
const id = await client.CharacterManager.getSpecId(acc.class, acc.spec)
|
||||
@@ -148,7 +154,7 @@ describe('Frontcraft', () => {
|
||||
pwhash: 'ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb', //hash("a")
|
||||
rank: 'ADMIN',
|
||||
username: 'a',
|
||||
currency: 2
|
||||
MC: 2
|
||||
}).then(adminUser => {
|
||||
|
||||
client.UserManager.login(adminUser.username, 'ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb').then(auth => {
|
||||
@@ -187,7 +193,8 @@ describe('Frontcraft', () => {
|
||||
let insertRaid = <Raid>{
|
||||
description: "Test raid 1",
|
||||
title: 'MC',
|
||||
start: Date.now().toString()
|
||||
start: Date.now().toString(),
|
||||
tier: 'MC'
|
||||
}
|
||||
|
||||
adminClient.manageRaid.createRaid(insertRaid).then(() => {
|
||||
@@ -391,6 +398,11 @@ describe('Frontcraft', () => {
|
||||
{class:'Paladin', specname:'Holy'},
|
||||
undefined, 2, "crit bias"
|
||||
),
|
||||
makePrio(
|
||||
'Empowered Leggings',
|
||||
{class:'Druid', specname:'Restoration'},
|
||||
undefined, 2, "crit bias"
|
||||
),
|
||||
|
||||
makePrio(
|
||||
'Boots of the Shadow Flame',
|
||||
@@ -516,7 +528,7 @@ describe('Frontcraft', () => {
|
||||
const user = Object.values(users)[0]
|
||||
const itemname = T1[0]
|
||||
|
||||
adminClient.softreserveCurrency.incrementCurrency(user.account, 2).then(async ()=>{
|
||||
adminClient.softreserveCurrency.incrementCurrency(user.account, raids[0].tier, 2).then(async ()=>{
|
||||
const item = await client.ItemManager.getItem(itemname)
|
||||
const before = await client.ItemManager.getToken(user.character, item)
|
||||
|
||||
@@ -538,7 +550,7 @@ describe('Frontcraft', () => {
|
||||
|
||||
it('should buy more tokens', (done) => {
|
||||
Promise.all(Object.values(users).map(async (user) => {
|
||||
await adminClient.softreserveCurrency.incrementCurrency(user.account, 1)
|
||||
await adminClient.softreserveCurrency.incrementCurrency(user.account,raids[0].tier, 1)
|
||||
return await client.ItemManager
|
||||
.buyToken(
|
||||
user.auth.token.value,
|
||||
@@ -565,7 +577,7 @@ describe('Frontcraft', () => {
|
||||
const dbRaids = await client.RaidManager.getRaids()
|
||||
if(dbRaids.length === 0){
|
||||
await client.UserManager.getUser(testAccounts[0].name).then(dbUser => {
|
||||
if(dbUser && dbUser.currency === 1){
|
||||
if(dbUser && dbUser.MC === 1){
|
||||
adminClient.signup.getSignups(raids[0]).then(signups => {
|
||||
if(signups.length === 0){
|
||||
done()
|
||||
@@ -586,9 +598,9 @@ describe('Frontcraft', () => {
|
||||
it('reset system', (done) => {
|
||||
adminClient.reset.wipeCurrencyAndItems().then(() => {
|
||||
client.UserManager.getUser(testAccounts[0].name).then(user => {
|
||||
if(user && user.currency === 0){
|
||||
client.ItemManager.getTokens(users[testAccounts[0].name.toLowerCase()].character).then(tokens => {
|
||||
if(tokens.length === 0){
|
||||
if(user && user.MC === 1){
|
||||
client.ItemManager.getTokens(users[testAccounts[0].name.toLowerCase()].character, ['MC']).then(tokens => {
|
||||
if(tokens!.length === 0){
|
||||
done()
|
||||
}else{
|
||||
console.log(tokens);
|
||||
@@ -599,6 +611,5 @@ describe('Frontcraft', () => {
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user