@@ -21,9 +21,9 @@ var clearInfo = function (key, cb) {
2121 cb ( ! ~ [ 'info' , 'index' ] . indexOf ( key ) ) ;
2222} ;
2323
24- var itShouldHaveTests = function ( test , key ) {
24+ var itShouldHaveTests = function ( test , func , key ) {
2525 it ( key + ' should have tests' , function ( done ) {
26- test . should . be . exist ;
26+ test . should . have . property ( func ) ;
2727 done ( ) ;
2828 } ) ;
2929} ;
@@ -44,7 +44,7 @@ var itShouldHaveInfo = function (targets, key) {
4444
4545var itShouldHaveRequestTestOutputFixture = function ( request , target , path ) {
4646 it ( 'should have output test for ' + request , function ( done ) {
47- Object . keys ( output ) . should . containEql ( target + '/' + path + request + snippet . extname ( target ) ) ;
47+ Object . keys ( output ) . indexOf ( target + '/' + path + request + snippet . extname ( target ) ) . should . be . greaterThan ( - 1 ) ;
4848
4949 done ( ) ;
5050 } ) ;
@@ -66,12 +66,23 @@ var itShouldGenerateOutput = function (request, path, target, client) {
6666 }
6767} ;
6868
69+ describe ( 'Available Targets' , function ( ) {
70+ var targets = snippet . availableTargets ( ) ;
71+
72+ targets . map ( function ( target ) {
73+ it ( 'available-targets.json should include ' + target . title , function ( done ) {
74+ fixtures [ 'available-targets' ] . should . containEql ( target ) ;
75+ done ( ) ;
76+ } ) ;
77+ } ) ;
78+ } ) ;
79+
6980// test all the things!
7081async . each ( Object . keys ( targets ) , function ( target ) {
7182 describe ( targets [ target ] . info . title , function ( ) {
7283 itShouldHaveInfo ( targets , target ) ;
7384
74- itShouldHaveTests ( tests [ target ] , target ) ;
85+ itShouldHaveTests ( tests , target , target ) ;
7586
7687 if ( typeof tests [ target ] === 'function' ) {
7788 tests [ target ] ( snippet , fixtures ) ;
@@ -94,9 +105,9 @@ async.each(Object.keys(targets), function (target) {
94105 describe ( client , function ( ) {
95106 itShouldHaveInfo ( targets [ target ] , client ) ;
96107
97- itShouldHaveTests ( tests [ target ] [ client ] , client ) ;
108+ itShouldHaveTests ( tests [ target ] , client , client ) ;
98109
99- if ( typeof tests [ target ] [ client ] === 'function' ) {
110+ if ( tests [ target ] && typeof tests [ target ] [ client ] === 'function' ) {
100111 tests [ target ] [ client ] ( snippet , fixtures ) ;
101112 }
102113
0 commit comments