<commit_before>jsf = require('../lib')

describe 'JSON-Schema references', ->
  it 'should handle internal $refs', ->
    schema = require('./fixtures/refs-schema.json')

    expect(jsf schema).toHaveSchema schema

  it 'should handle provided $refs only', ->
    schema =
      type: 'object'
      properties:
        stringValues:
          type: 'array'
          items:
            $ref: 'localSchema'
          minItems: 3
      required: ['stringValues']

    refs = [
      { id: 'localSchema', type: 'string' }
    ]

    expect(jsf(schema, refs)).toHaveSchema schema, refs<commit_msg>Validate against full-refs only<commit_after>jsf = require('../lib')

describe 'JSON-Schema references', ->
  it 'should handle internal $refs', ->
    schema = require('./fixtures/refs-schema.json')

    expect(jsf schema).toHaveSchema schema

  it 'should handle provided $refs only', ->
    schema =
      type: 'object'
      properties:
        stringValues:
          type: 'array'
          items:
            $ref: 'http://fake.com/localSchema'
          minItems: 3
      required: ['stringValues']

    refs = [
      { id: 'http://fake.com/localSchema', type: 'string' }
    ]

    expect(jsf(schema, refs)).toHaveSchema schema, refs
{'fraction_non_alphanumeric': 0.13974151857835218, 'fraction_numerical': 0.0016155088852988692, 'mean_word_length': 2.4132231404958677, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5601175', 'n_tokens_mistral': 383, 'n_tokens_neox': 362, 'n_words': 90}