'use strict';

const assert = require('./../assert');

describe('Mod loader', function () {
	// This fails due to relative path being wrong, not necessarily failing tests
	it.skip('should work fine in any order', function () {
		{
			Chat.uncacheTree('./.sim-dist/dex');
			const Dex = require('./../../../.sim-dist/dex').Dex;
			assert.equal(Dex.mod('gen2').getSpecies('nidoking').learnset.bubblebeam.join(','), '1M');
			assert.equal(Dex.mod('gen2').getMove('crunch').secondaries[0].boosts.def, undefined);
		}
		{
			Chat.uncacheTree('./.sim-dist/dex');
			const Dex = require('./../../../.sim-dist/dex').Dex;
			Dex.mod('gen2').getSpecies('nidoking');
			Dex.mod('gen4').getMove('crunch');
			assert.equal(Dex.mod('gen2').getSpecies('nidoking').learnset.bubblebeam.join(','), '1M');
			assert.equal(Dex.mod('gen2').getMove('crunch').secondaries[0].boosts.def, undefined);
		}
	});
});

describe('Dex#getEffect', function () {
	it('returns the same object for the same id', function () {
		assert.equal(Dex.getEffect('Stealth Rock'), Dex.getEffect('stealthrock'));
		assert.notStrictEqual(Dex.getEffect('move: Stealth Rock'), Dex.getEffect('stealthrock'));
	});

	it('does not return elements from the Object prototype', function () {
		assert.false(Dex.getEffect('constructor').exists);
	});
});

describe('Dex#getSpecies', function () {
	it('should handle cosmetic Flabébé formes', function () {
		assert.equal(Dex.getSpecies('Flabébé-yellow').name, 'Flabébé-Yellow');
	});

	it('should handle Minior-Meteor formes', function () {
		assert(Dex.getSpecies('Minior-Meteor').isNonstandard);
		assert(!Dex.forGen(7).getSpecies('Minior-Meteor').isNonstandard);
	});

	it.skip('should handle Rockruff-Dusk', function () {
		assert.equal(Dex.getSpecies('Rockruff-Dusk').name, 'Rockruff-Dusk');
	});
});

describe('Dex#getItem', function () {
	it('should not mark Gems as as Nonstandard in Gens 5-7', function () {
		assert(!Dex.forGen(5).getItem('Rock Gem').isNonstandard);
		assert(!Dex.forGen(5).getItem('Normal Gem').isNonstandard);

		assert(Dex.forGen(6).getItem('Rock Gem').isNonstandard === 'Unobtainable');
		assert(!Dex.forGen(6).getItem('Normal Gem').isNonstandard);

		assert(Dex.forGen(8).getItem('Rock Gem').isNonstandard === 'Past');
	});
});

@@ -90,94 +90,10 @@
  %7B%0A%09
-// This fails due to relative path being wrong, not necessarily failing tests%0A%09it.skip
+it
 ('sh
@@ -205,35 +205,32 @@
 quire('./../../.
-./.
 sim-dist/dex').D
@@ -260,39 +260,44 @@
 .mod('gen2').get
-Species
+LearnsetData
 ('nidoking').lea
@@ -497,27 +497,24 @@
 e('./../../.
-./.
 sim-dist/dex
@@ -535,39 +535,44 @@
 .mod('gen2').get
-Species
+LearnsetData
 ('nidoking');%0A%09%09
@@ -642,23 +642,28 @@
 n2').get
-Species
+LearnsetData
 ('nidoki

Fix mod loader test