Permalink
Browse files

Switching tests to tap.

  • Loading branch information...
1 parent 2658473 commit 705e24822be9ae4e3b5f8a14acd90fa510fc26d1 @xtian committed Mar 4, 2012
Showing with 495 additions and 511 deletions.
  1. +1 −1 Makefile
  2. +1 −1 package.json
  3. +49 −51 tests/arena.test.js
  4. +75 −76 tests/auction.test.js
  5. +73 −74 tests/character.test.js
  6. +44 −46 tests/data.test.js
  7. +50 −54 tests/guild.test.js
  8. +16 −18 tests/item.test.js
  9. +44 −46 tests/quest.test.js
  10. +142 −144 tests/realm.test.js
View
2 Makefile
@@ -1,6 +1,6 @@
test:
- node_modules/.bin/nodeunit tests
+ node_modules/.bin/tap tests
lint:
node_modules/.bin/jshint index.js ./tests/
View
2 package.json
@@ -16,7 +16,7 @@
"request": "~2"
},
"devDependencies": {
- "nodeunit": "~0.7.0",
+ "tap": "~0.2.0",
"jshint": "~0.5.0"
},
"scripts": {
View
100 tests/arena.test.js
@@ -1,58 +1,56 @@
-var armory = require('../').defaults({
- region: 'us',
- battlegroup: 'Vindication',
- realm: 'Shadowmoon'
+var test = require('tap').test,
+ armory = require('../').defaults({
+ region: 'us',
+ battlegroup: 'Vindication',
+ realm: 'Shadowmoon'
+ });
+
+test('single team', function(test) {
+ armory.arena({ name: 'No Dairy', size: '2v2' }, function(err, team) {
+ test.error(err);
+ test.ok(team);
+ test.equal(team.name, 'No Dairy');
+ test.end();
+ });
});
-module.exports = {
-
- 'single team': function(test) {
- armory.arena({ name: 'No Dairy', size: '2v2' }, function(err, team) {
- test.ifError(err);
- test.ok(team);
- test.equal(team.name, 'No Dairy');
- test.done();
- });
- },
-
- 'non-existent team': function(test) {
- armory.arena({ name: 'foo', size: '2v2' }, function(err, team) {
- test.ok(err);
- test.done();
- });
- },
+test('non-existent team', function(test) {
+ armory.arena({ name: 'foo', size: '2v2' }, function(err, team) {
+ test.ok(err);
+ test.end();
+ });
+});
- 'empty options': function(test) {
- armory.arena({}, function(err, team) {
- test.ok(err);
- test.done();
- });
- },
+test('empty options', function(test) {
+ armory.arena({}, function(err, team) {
+ test.ok(err);
+ test.end();
+ });
+});
- 'single ladder': function(test) {
- armory.ladder({ name: '2v2' }, function(err, ladder) {
- test.ifError(err);
- test.ok(Array.isArray(ladder));
- test.ok(ladder.length);
- test.done();
- });
- },
+test('single ladder', function(test) {
+ armory.ladder({ name: '2v2' }, function(err, ladder) {
+ test.error(err);
+ test.ok(Array.isArray(ladder));
+ test.ok(ladder.length);
+ test.end();
+ });
+});
- 'non-existent ladder': function(test) {
- armory.ladder({ name: 'foo' }, function(err, ladder) {
- test.ok(err);
- test.done();
- });
- },
+test('non-existent ladder', function(test) {
+ armory.ladder({ name: 'foo' }, function(err, ladder) {
+ test.ok(err);
+ test.end();
+ });
+});
- 'non-existent battlegroup': function(test) {
- armory.ladder({
- name: '2v2',
- battlegroup: 'foo'
+test('non-existent battlegroup', function(test) {
+ armory.ladder({
+ name: '2v2',
+ battlegroup: 'foo'
- }, function(err, ladder) {
- test.ok(err);
- test.done();
- });
- }
-};
+ }, function(err, ladder) {
+ test.ok(err);
+ test.end();
+ });
+});
View
151 tests/auction.test.js
@@ -1,92 +1,91 @@
-var armory = require('../').defaults({ region: 'us' });
+var test = require('tap').test,
+ armory = require('../').defaults({ region: 'us' });
-module.exports = {
+test('single realm', function(test) {
+ armory.auction('Shadowmoon', function(err, urls) {
+ test.error(err);
+ test.ok(Array.isArray(urls));
+ test.ok(urls.length);
+ test.end();
+ });
+});
- 'single realm': function(test) {
- armory.auction('Shadowmoon', function(err, urls) {
- test.ifError(err);
- test.ok(Array.isArray(urls));
- test.ok(urls.length);
- test.done();
- });
- },
-
- 'region': function(test) {
- armory.auction(
- { name: 'Свежеватель Душ', region: 'eu' },
- function(err, urls) {
- test.ifError(err);
- test.ok(Array.isArray(urls));
- test.ok(urls.length);
- test.done();
- }
- );
- },
+test('region', function(test) {
+ armory.auction({
+ name: 'Свежеватель Душ',
+ region: 'eu'
- 'lastModified': function(test) {
- armory.auction('Shadowmoon', function(err, urls) {
- test.ifError(err);
- test.ok(Array.isArray(urls));
- test.ok(urls[0].lastModified);
+ }, function(err, urls) {
+ test.error(err);
+ test.ok(Array.isArray(urls));
+ test.ok(urls.length);
+ test.end();
+ });
+});
- var lastModified = urls[0].lastModified;
+test('lastModified', function(test) {
+ armory.auction('Shadowmoon', function(err, urls) {
+ test.error(err);
+ test.ok(Array.isArray(urls));
+ test.ok(urls[0].lastModified);
- armory.auction({
- name: 'Shadowmoon',
- lastModified: lastModified
+ var lastModified = urls[0].lastModified;
- }, function(err, res) {
- test.ifError(err);
- test.equal(res, undefined);
- test.done();
+ armory.auction({
+ name: 'Shadowmoon',
+ lastModified: lastModified
- });
+ }, function(err, res) {
+ test.error(err);
+ test.equal(res, undefined);
+ test.end();
});
- },
+ });
+});
- 'single realm data': function(test) {
- armory.auctionData('Shadowmoon', function(err, res) {
- test.ifError(err);
- test.ok(res);
- test.ok(res.alliance);
- test.ok(res.horde);
- test.ok(res.neutral);
- test.done();
- });
- },
+test('single realm data', function(test) {
+ armory.auctionData('Shadowmoon', function(err, res) {
+ test.error(err);
+ test.ok(res);
+ test.ok(res.alliance);
+ test.ok(res.horde);
+ test.ok(res.neutral);
+ test.end();
+ });
+});
- 'data with region': function(test) {
- armory.auctionData({
- name: 'Tarren Mill',
- region: 'eu'
+test('data with region', function(test) {
+ armory.auctionData({
+ name: 'Tarren Mill',
+ region: 'eu'
- }, function(err, res) {
- test.ifError(err);
- test.ok(res);
- test.ok(res.alliance);
- test.ok(res.horde);
- test.ok(res.neutral);
- test.done();
- });
- },
+ }, function(err, res) {
+ test.error(err);
+ test.ok(res);
+ test.ok(res.alliance);
+ test.ok(res.horde);
+ test.ok(res.neutral);
+ test.end();
+ });
+});
- 'data with lastModified': function(test) {
- armory.auction('Shadowmoon', function(err, urls) {
- test.ifError(err);
- test.ok(urls);
- test.ok(urls[0].lastModified);
+test('data with lastModified', function(test) {
+ armory.auction('Shadowmoon', function(err, urls) {
+ test.error(err);
+ test.ok(urls);
+ test.ok(urls[0].lastModified);
- var lastModified = urls[0].lastModified;
+ var lastModified = urls[0].lastModified;
- armory.auctionData({
- name: 'Shadowmoon',
- lastModified: lastModified
+ armory.auctionData({
+ name: 'Shadowmoon',
+ lastModified: lastModified
- }, function(err, res) {
- test.ifError(err);
- test.equal(res, undefined);
- test.done();
- });
+ }, function(err, res) {
+ test.error(err);
+ test.equal(res, undefined);
+ test.end();
});
- }
-};
+ });
+});
+
View
147 tests/character.test.js
@@ -1,86 +1,85 @@
-var armory = require('../').defaults({
- region: 'us',
- realm: 'Shadowmoon',
- name: 'Dargonaut'
-});
+var test = require('tap').test,
+ armory = require('../').defaults({
+ region: 'us',
+ realm: 'Shadowmoon',
+ name: 'Dargonaut'
+ });
-module.exports = {
+test('single character', function(test) {
+ armory.character(function(err, character) {
+ test.error(err);
+ test.ok(character);
+ test.equal(character.name, 'Dargonaut');
+ test.end();
+ });
+});
- 'single character': function(test) {
- armory.character(function(err, character) {
- test.ifError(err);
- test.ok(character);
- test.equal(character.name, 'Dargonaut');
- test.done();
- });
- },
+test('international name and server', function(test) {
+ armory.character({
+ name: 'Альвеона',
+ realm: 'Свежеватель Душ',
+ region: 'eu'
- 'international name and server': function(test) {
- armory.character({
- name: 'Альвеона',
- realm: 'Свежеватель Душ',
- region: 'eu'
+ }, function(err, character) {
+ test.error(err);
+ test.ok(character);
+ test.equal(character.name, 'Альвеона');
+ test.end();
+ });
+});
- }, function(err, character) {
- test.ifError(err);
- test.ok(character);
- test.equal(character.name, 'Альвеона');
- test.done();
- });
- },
+test('additional fields', function(test) {
+ armory.character({ fields: ['items', 'talents'] }, function(err, res) {
+ test.error(err);
+ test.ok(res);
+ test.ok(res.items);
+ test.ok(Array.isArray(res.talents));
+ test.end();
+ });
+});
- 'additional fields': function(test) {
- armory.character({ fields: ['items', 'talents'] }, function(err, res) {
- test.ifError(err);
- test.ok(res);
- test.ok(res.items);
- test.ok(Array.isArray(res.talents));
- test.done();
- });
- },
+test('additional fields with locale', function(test) {
+ armory.character({
+ fields: ['titles'],
+ locale: 'es_MX'
- 'additional fields with locale': function(test) {
- armory.character({
- fields: ['titles'],
- locale: 'es_MX'
- }, function(err, character) {
- test.ifError(err);
- test.ok(character);
- test.ok(character.titles);
- test.equal(character.titles[0].name,
- '%s, Campeón de los baldíos helados');
- test.done();
- });
- },
+ }, function(err, character) {
+ test.error(err);
+ test.ok(character);
+ test.ok(character.titles);
+ test.equal(character.titles[0].name,
+ '%s, Campeón de los baldíos helados');
+ test.end();
+ });
+});
- 'lastModified': function(test) {
- armory.character(function(err, character) {
- test.ifError(err);
- test.ok(character);
- test.ok(character.lastModified);
+test('lastModified', function(test) {
+ armory.character(function(err, character) {
+ test.error(err);
+ test.ok(character);
+ test.ok(character.lastModified);
- armory.character({
- lastModified: character.lastModified
+ armory.character({
+ lastModified: character.lastModified
- }, function(err, character) {
- test.ifError(err);
- test.equal(character, undefined);
- test.done();
- });
+ }, function(err, character) {
+ test.error(err);
+ test.equal(character, undefined);
+ test.end();
});
- },
+ });
+});
- 'non-existent character': function(test) {
- armory.character('foo', function(err, character) {
- test.ok(err);
- test.done();
- });
- },
+test('non-existent character', function(test) {
+ armory.character('foo', function(err, character) {
+ test.ok(err);
+ test.end();
+ });
+});
- 'empty options': function(test) {
- require('../').character({}, function(err, character) {
- test.ok(err);
- test.done();
- });
- }
-};
+test('empty options', function(test) {
+ require('../').character({}, function(err, character) {
+ test.ok(err);
+ test.end();
+ });
+});
View
90 tests/data.test.js
@@ -1,51 +1,49 @@
-var armory = require('../').defaults({ region: 'us' });
+var test = require('tap').test,
+ armory = require('../').defaults({ region: 'us' });
-module.exports = {
+test('region', function(test) {
+ armory.races({ region: 'eu' }, function(err, races) {
+ test.error(err);
+ test.ok(Array.isArray(races));
+ test.ok(races.length);
+ test.end();
+ });
+});
- 'region': function(test) {
- armory.races({ region: 'eu' }, function(err, races) {
- test.ifError(err);
- test.ok(Array.isArray(races));
- test.ok(races.length);
- test.done();
- });
- },
+test('locale', function(test) {
+ armory.races({ locale: 'es_MX' }, function(err, races) {
+ test.error(err);
+ test.ok(Array.isArray(races));
+ test.ok(races.length);
+ test.equal(races[0].name, 'Humano');
+ test.end();
+ });
+});
- 'locale': function(test) {
- armory.races({ locale: 'es_MX' }, function(err, races) {
- test.ifError(err);
- test.ok(Array.isArray(races));
- test.ok(races.length);
- test.equal(races[0].name, 'Humano');
- test.done();
- });
- },
+test('region and locale', function(test) {
+ armory.races({ region: 'eu', locale: 'de_DE' }, function(err, races) {
+ test.error(err);
+ test.ok(Array.isArray(races));
+ test.ok(races.length);
+ test.equal(races[1].name, 'Mensch');
+ test.end();
+ });
+});
- 'region and locale': function(test) {
- armory.races({ region: 'eu', locale: 'de_DE' }, function(err, races) {
- test.ifError(err);
- test.ok(Array.isArray(races));
- test.ok(races.length);
- test.equal(races[1].name, 'Mensch');
- test.done();
- });
- },
+test('battlegroups', function(test) {
+ armory.battlegroups(function(err, results) {
+ test.error(err);
+ test.ok(Array.isArray(results));
+ test.ok(results.length);
+ test.end();
+ });
+});
- 'battlegroups': function(test) {
- armory.battlegroups(function(err, results) {
- test.ifError(err);
- test.ok(Array.isArray(results));
- test.ok(results.length);
- test.done();
- });
- },
-
- 'characterAcheivements': function(test) {
- armory.characterAchievements(function(err, results) {
- test.ifError(err);
- test.ok(Array.isArray(results));
- test.ok(results.length);
- test.done();
- });
- }
-};
+test('characterAcheivements', function(test) {
+ armory.characterAchievements(function(err, results) {
+ test.error(err);
+ test.ok(Array.isArray(results));
+ test.ok(results.length);
+ test.end();
+ });
+});
View
104 tests/guild.test.js
@@ -1,63 +1,59 @@
-var armory = require('../').defaults({
- region: 'us',
- realm: 'Shadowmoon',
- name: 'The Gentlemens Club'
+var test = require('tap').test,
+ armory = require('../').defaults({
+ region: 'us',
+ realm: 'Shadowmoon',
+ name: 'The Gentlemens Club'
+ });
+
+test('single guild', function(test) {
+ armory.guild(function(err, guild) {
+ test.error(err);
+ test.ok(guild);
+ test.equal(guild.name, 'The Gentlemens Club');
+ test.end();
+ });
});
-module.exports = {
+test('additional fields', function(test) {
+ armory.guild({ fields: ['members', 'achievements'] }, function(err, guild) {
+ test.error(err);
+ test.ok(guild);
+ test.ok(Array.isArray(guild.members));
+ test.ok(guild.members.length);
+ test.ok(guild.achievements);
+ test.ok(Array.isArray(guild.achievements.criteria));
+ test.ok(guild.achievements.criteria.length);
+ test.end();
+ });
+});
- 'single guild': function(test) {
- armory.guild(function(err, guild) {
- test.ifError(err);
- test.ok(guild);
- test.equal(guild.name, 'The Gentlemens Club');
- test.done();
- });
- },
+test('lastModified', function(test) {
+ armory.guild(function(err, guild) {
+ test.error(err);
+ test.ok(guild);
+ test.ok(guild.lastModified);
- 'additional fields': function(test) {
armory.guild({
- fields: ['members', 'achievements']
- }, function(err, guild) {
- test.ifError(err);
- test.ok(guild);
- test.ok(Array.isArray(guild.members));
- test.ok(guild.members.length);
- test.ok(guild.achievements);
- test.ok(Array.isArray(guild.achievements.criteria));
- test.ok(guild.achievements.criteria.length);
- test.done();
- });
- },
-
- 'lastModified': function(test) {
- armory.guild(function(err, guild) {
- test.ifError(err);
- test.ok(guild);
- test.ok(guild.lastModified);
-
- armory.guild({
- lastModified: guild.lastModified
+ lastModified: guild.lastModified
- }, function(err, guild) {
- test.ifError(err);
- test.equal(guild, undefined);
- test.done();
- });
+ }, function(err, guild) {
+ test.error(err);
+ test.equal(guild, undefined);
+ test.end();
});
- },
+ });
+});
- 'non-existent guild': function(test) {
- armory.guild('foo', function(err, guild) {
- test.ok(err);
- test.done();
- });
- },
+test('non-existent guild', function(test) {
+ armory.guild('foo', function(err, guild) {
+ test.ok(err);
+ test.end();
+ });
+});
- 'empty options': function(test) {
- require('../').guild({}, function(err, guild) {
- test.ok(err);
- test.done();
- });
- }
-};
+test('empty options', function(test) {
+ require('../').guild({}, function(err, guild) {
+ test.ok(err);
+ test.end();
+ });
+});
View
34 tests/item.test.js
@@ -1,20 +1,18 @@
-var armory = require('../').defaults({ region: 'us' });
+var test = require('tap').test,
+ armory = require('../').defaults({ region: 'us' });
-module.exports = {
+test('single item', function(test) {
+ armory.item(27987, function(err, item) {
+ test.error(err);
+ test.ok(item);
+ test.equal(item.id, 27987);
+ test.end();
+ });
+});
- 'single item': function(test) {
- armory.item(27987, function(err, item) {
- test.ifError(err);
- test.ok(item);
- test.equal(item.id, 27987);
- test.done();
- });
- },
-
- 'non-existent item': function(test) {
- armory.item(0, function(err, item) {
- test.ok(err);
- test.done();
- });
- }
-};
+test('non-existent item', function(test) {
+ armory.item(0, function(err, item) {
+ test.ok(err);
+ test.end();
+ });
+});
View
90 tests/quest.test.js
@@ -1,52 +1,50 @@
-var armory = require('../').defaults({ region: 'us' });
+var test = require('tap').test,
+ armory = require('../').defaults({ region: 'us' });
-module.exports = {
+test('single quest', function(test) {
+ armory.quest(11546, function(err, quest) {
+ test.error(err);
+ test.ok(quest);
+ test.equal(quest.id, 11546);
+ test.end();
+ });
+});
- 'single quest': function(test) {
- armory.quest(11546, function(err, quest) {
- test.ifError(err);
- test.ok(quest);
- test.equal(quest.id, 11546);
- test.done();
- });
- },
+test('region', function(test) {
+ armory.quest({ id: 11546, region: 'eu' }, function(err, quest) {
+ test.error(err);
+ test.ok(quest);
+ test.equal(quest.id, 11546);
+ test.end();
+ });
+});
- 'region': function(test) {
- armory.quest({ id: 11546, region: 'eu' }, function(err, quest) {
- test.ifError(err);
- test.ok(quest);
- test.equal(quest.id, 11546);
- test.done();
- });
- },
+test('locale', function(test) {
+ armory.quest({ id: 11546, locale: 'de_DE' }, function(err, quest) {
+ test.error(err);
+ test.ok(quest);
+ test.equal(quest.id, 11546);
+ test.end();
+ });
+});
- 'locale': function(test) {
- armory.quest({ id: 11546, locale: 'de_DE' }, function(err, quest) {
- test.ifError(err);
- test.ok(quest);
- test.equal(quest.id, 11546);
- test.done();
- });
- },
+test('region and locale', function(test) {
+ armory.quest({
+ id: 11546,
+ region: 'eu',
+ locale: 'de_DE'
- 'region and locale': function(test) {
- armory.quest({
- id: 11546,
- region: 'eu',
- locale: 'de_DE'
+ }, function(err, quest) {
+ test.error(err);
+ test.ok(quest);
+ test.equal(quest.id, 11546);
+ test.end();
+ });
+});
- }, function(err, quest) {
- test.ifError(err);
- test.ok(quest);
- test.equal(quest.id, 11546);
- test.done();
- });
- },
-
- 'non-existent quest': function(test) {
- armory.quest(0, function(err, quest) {
- test.ok(err);
- test.done();
- });
- }
-};
+test('non-existent quest', function(test) {
+ armory.quest(0, function(err, quest) {
+ test.ok(err);
+ test.end();
+ });
+});
View
286 tests/realm.test.js
@@ -1,144 +1,142 @@
-var armory = require('../').defaults({ region: 'us' });
-
-module.exports = {
-
- 'all US realms': function(test) {
- armory.realmStatus(function(err, realms) {
- test.ifError(err);
- test.ok(Array.isArray(realms));
- test.ok(realms.length > 1);
- test.ok(realms[0].slug);
-
- test.done();
- });
- },
-
- 'all US realms with locale': function(test) {
- armory.realmStatus({ locale: 'es_MX' }, function(err, realms) {
- test.ifError(err);
- test.ok(Array.isArray(realms));
- test.ok(realms.length > 1);
- test.ok(realms[0].slug);
-
- test.done();
- });
- },
-
- 'all EU realms': function(test) {
- armory.realmStatus({ region: 'eu' }, function(err, realms) {
- test.ifError(err);
- test.ok(Array.isArray(realms));
- test.ok(realms.length > 1);
- test.ok(realms[0].slug);
-
- test.done();
- });
- },
-
- 'all EU realms with locale': function(test) {
- armory.realmStatus({
- region: 'eu',
- locale: 'fr_FR'
-
- }, function(err, realms) {
- test.ifError(err);
- test.ok(Array.isArray(realms));
- test.ok(realms.length > 1);
- test.ok(realms[0].slug);
-
- test.done();
- });
- },
-
- 'single US realm': function(test) {
- armory.realmStatus('Shadowmoon', function(err, realms) {
- test.ifError(err);
- test.ok(Array.isArray(realms));
-
- realms = realms[0];
- test.equal(realms.name, 'Shadowmoon');
- test.equal(realms.slug, 'shadowmoon');
-
- test.done();
- });
- },
-
- 'single EU realm': function(test) {
- armory.realmStatus({
- name: 'Свежеватель Душ',
- region: 'eu'
-
- }, function(err, realms) {
- test.ifError(err);
- test.ok(Array.isArray(realms));
-
- realms = realms[0];
- test.equal(realms.name, 'Soulflayer');
- test.equal(realms.slug, 'soulflayer');
-
- test.done();
- });
- },
-
- 'single EU realm with locale': function(test) {
- armory.realmStatus({
- name: 'Свежеватель Душ',
- region: 'eu',
- locale: 'ru_RU'
-
- }, function(err, realms) {
- test.ifError(err);
- test.ok(Array.isArray(realms));
-
- realms = realms[0];
- test.equal(realms.name, 'Свежеватель Душ');
- test.equal(realms.slug, 'свежеватель-душ');
-
- test.done();
- });
- },
-
- 'multiple US realms': function(test) {
- armory.realmStatus(['Cho\'gall', 'Shadowmoon'], function(err, realms) {
- test.ifError(err);
- test.ok(Array.isArray(realms));
- test.equal(realms.length, 2);
-
- test.equal(realms[0].name, 'Shadowmoon');
- test.equal(realms[0].slug, 'shadowmoon');
- test.equal(realms[1].name, 'Cho\'gall');
- test.equal(realms[1].slug, 'chogall');
-
- test.done();
- });
- },
-
- 'multiple EU realms': function(test) {
- armory.realmStatus({
- name: ['Свежеватель Душ', 'Festung der Stürme'],
- region: 'eu'
-
- }, function(err, realms) {
-
- test.ifError(err);
- test.ok(Array.isArray(realms));
- test.equal(realms.length, 2);
-
- test.equal(realms[0].name, 'Soulflayer');
- test.equal(realms[0].slug, 'soulflayer');
- test.equal(realms[1].name, 'Festung der Stürme');
- test.equal(realms[1].slug, 'festung-der-sturme');
-
- test.done();
- });
- },
-
- 'non-existent realm': function(test) {
- armory.realmStatus('foo', function(err, realms) {
- test.ifError(err);
- test.ok(realms.length > 1);
-
- test.done();
- });
- }
-};
+var test = require('tap').test,
+ armory = require('../').defaults({ region: 'us' });
+
+test('all US realms', function(test) {
+ armory.realmStatus(function(err, realms) {
+ test.error(err);
+ test.ok(Array.isArray(realms));
+ test.ok(realms.length > 1);
+ test.ok(realms[0].slug);
+
+ test.end();
+ });
+});
+
+test('all US realms with locale', function(test) {
+ armory.realmStatus({ locale: 'es_MX' }, function(err, realms) {
+ test.error(err);
+ test.ok(Array.isArray(realms));
+ test.ok(realms.length > 1);
+ test.ok(realms[0].slug);
+
+ test.end();
+ });
+});
+
+test('all EU realms', function(test) {
+ armory.realmStatus({ region: 'eu' }, function(err, realms) {
+ test.error(err);
+ test.ok(Array.isArray(realms));
+ test.ok(realms.length > 1);
+ test.ok(realms[0].slug);
+
+ test.end();
+ });
+});
+
+test('all EU realms with locale', function(test) {
+ armory.realmStatus({
+ region: 'eu',
+ locale: 'fr_FR'
+
+ }, function(err, realms) {
+ test.error(err);
+ test.ok(Array.isArray(realms));
+ test.ok(realms.length > 1);
+ test.ok(realms[0].slug);
+
+ test.end();
+ });
+});
+
+test('single US realm', function(test) {
+ armory.realmStatus('Shadowmoon', function(err, realms) {
+ test.error(err);
+ test.ok(Array.isArray(realms));
+
+ realms = realms[0];
+ test.equal(realms.name, 'Shadowmoon');
+ test.equal(realms.slug, 'shadowmoon');
+
+ test.end();
+ });
+});
+
+test('single EU realm', function(test) {
+ armory.realmStatus({
+ name: 'Свежеватель Душ',
+ region: 'eu'
+
+ }, function(err, realms) {
+ test.error(err);
+ test.ok(Array.isArray(realms));
+
+ realms = realms[0];
+ test.equal(realms.name, 'Soulflayer');
+ test.equal(realms.slug, 'soulflayer');
+
+ test.end();
+ });
+});
+
+test('single EU realm with locale', function(test) {
+ armory.realmStatus({
+ name: 'Свежеватель Душ',
+ region: 'eu',
+ locale: 'ru_RU'
+
+ }, function(err, realms) {
+ test.error(err);
+ test.ok(Array.isArray(realms));
+
+ realms = realms[0];
+ test.equal(realms.name, 'Свежеватель Душ');
+ test.equal(realms.slug, 'свежеватель-душ');
+
+ test.end();
+ });
+});
+
+test('multiple US realms', function(test) {
+ armory.realmStatus(['Cho\'gall', 'Shadowmoon'], function(err, realms) {
+ test.error(err);
+ test.ok(Array.isArray(realms));
+ test.equal(realms.length, 2);
+
+ test.equal(realms[0].name, 'Shadowmoon');
+ test.equal(realms[0].slug, 'shadowmoon');
+ test.equal(realms[1].name, 'Cho\'gall');
+ test.equal(realms[1].slug, 'chogall');
+
+ test.end();
+ });
+});
+
+test('multiple EU realms', function(test) {
+ armory.realmStatus({
+ name: ['Свежеватель Душ', 'Festung der Stürme'],
+ region: 'eu'
+
+ }, function(err, realms) {
+
+ test.error(err);
+ test.ok(Array.isArray(realms));
+ test.equal(realms.length, 2);
+
+ test.equal(realms[0].name, 'Soulflayer');
+ test.equal(realms[0].slug, 'soulflayer');
+ test.equal(realms[1].name, 'Festung der Stürme');
+ test.equal(realms[1].slug, 'festung-der-sturme');
+
+ test.end();
+ });
+});
+
+test('non-existent realm', function(test) {
+ armory.realmStatus('foo', function(err, realms) {
+ test.error(err);
+ test.ok(realms.length > 1);
+
+ test.end();
+ });
+});

0 comments on commit 705e248

Please sign in to comment.