-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The first version of an actual test. This one tests access to the WoW Community Achievement API and verifies it's available, returning the results.
- Loading branch information
Showing
7 changed files
with
130 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,5 @@ build/Release | |
node_modules | ||
|
||
# IDE Directory | ||
.vscode/ | ||
.vscode/ | ||
config\.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* config.json = | ||
* { | ||
* apikey: 'supersecret' | ||
* } | ||
*/ | ||
const config = require('./config.json') | ||
|
||
const AchievementTest = require('./tests/access/community/wow/achievements/retrieve-achievement') | ||
const test = new AchievementTest({apikey: config.apikey}) | ||
|
||
test.execute().then(response => console.log(response)) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
"name": "@targetdummy/test-runner", | ||
"version": "0.0.1", | ||
"description": "The test runner for TargetDummy", | ||
"main": "index.js", | ||
"author": { | ||
"name": "Alcha", | ||
"email": "[email protected]", | ||
|
@@ -12,9 +13,11 @@ | |
"type": "git", | ||
"url": "https://github.com/bnettargetdummy/test-runner.git" | ||
}, | ||
"scripts": { | ||
"start": "node index.js" | ||
}, | ||
"dependencies": { | ||
"@targetdummy/logger": "BNetTargetDummy/logger", | ||
"async": "2.5.0", | ||
"blizzard.js": "1.7.0" | ||
}, | ||
"devDependencies": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
tests/access/community/wow/achievements/retrieve-achievement.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
const Access = require('../../../../../src/access') | ||
|
||
class RetrieveAchievement extends Access { | ||
constructor (options) { | ||
super(options) | ||
|
||
this.name = 'WoWAchievement Test' | ||
this.description = 'Tests the WoW Community Achievement endpoint.' | ||
} | ||
|
||
pass (args) { | ||
return { | ||
result: 'PASS', | ||
status: args.status, | ||
data: args.data | ||
} | ||
} | ||
|
||
fail (args) { | ||
return { | ||
result: 'FAIL', | ||
status: args.status, | ||
reason: args.data.detail | ||
} | ||
} | ||
|
||
requestObject () { | ||
return { | ||
game: 'wow', | ||
type: 'achievement', | ||
args: { | ||
id: 2144, | ||
origin: 'us' | ||
} | ||
} | ||
} | ||
|
||
execute () { | ||
return new Promise((resolve, reject) => { | ||
super.executeWoWRequest(this.requestObject()).then(response => { | ||
switch (parseInt(response.status)) { | ||
case 200: | ||
resolve(this.pass(response)) | ||
break | ||
|
||
case 403: | ||
resolve(this.fail(response)) | ||
break | ||
|
||
default: | ||
console.log(response) | ||
} | ||
}) | ||
}) | ||
} | ||
} | ||
|
||
module.exports = RetrieveAchievement |