 lib = require '../index'
 
 describe 'Schemas', ->
+  schemas = []
   before: ->
     metaSchema = loadSchema path.join __dirname, 'json-schema.json'
     tv4.addSchema 'http://json-schema.org/draft-04/schema', metaSchema

            it "should be valid", ->
              results = tv4.validateMultiple testcase._data, schema.id
              chai.expect(results.errors).to.eql []
          else
            it "should be invalid", ->
              results = tv4.validateMultiple testcase._data, schema.id
              chai.expect(results.errors).to.not.eql []


  lib.listSchemas().forEach (schemaName) ->
    schema = lib.getSchema schemaName
    tv4.addSchema schema.id, schema
    schemas.push schema

  schemas.forEach (schema) ->
    describe "#{schema.id} (#{schema.title})", ->
      try
        cases = lib.getExamples schemaName
