<commit_before>
'use strict';

const ava = require('ava'),
  restHalTestTools = require('../'),
  superTest = require('supertest');

ava("resourceImplementOptionsMethod fail if agent not provided", (t) => {
  t.throws(() => {
    let testContext = { context: {} };

    restHalTestTools.resourceImplementOptionsMethod(testContext);
  }, 'Cannot read property \'options\' of undefined');
});

ava("resourceImplementOptionsMethod fail if resource not provided", (t) => {
  t.throws(() => {
    let testContext = { context: {
      agent: superTest('http://some.api')
    } };

    restHalTestTools.resourceImplementOptionsMethod(testContext);
  }, 'undefined');
});<commit_msg>Added tests for the resourceImplementOptionsMethod function<commit_after>
'use strict';

const ava = require('ava'),
  restHalTestTools = require('../'),
  superTest = require('supertest');

ava("resourceImplementOptionsMethod fail if agent not provided", (t) => {
  let testContext = { context: {} };

  t.throws(
    restHalTestTools.resourceImplementOptionsMethod.bind(null, testContext),
    'Cannot read property \'options\' of undefined'
  );
});

ava("resourceImplementOptionsMethod fail if resource not provided", (t) => {
  let testContext = { context: {
    agent: superTest('http://some.api')
  } };

  t.throws(
    restHalTestTools.resourceImplementOptionsMethod.bind(null, testContext),
    'undefined'
  );
});

ava("resourceImplementOptionsMethod fail if status is not 200", (t) => {
  function handler(_, res){
    res.statusCode = 300;
    res.end();
  }

  let testContext = { context: {
    resource: "/",
    agent: superTest(handler)
  } };

  restHalTestTools.resourceImplementOptionsMethod(testContext)
    .end((res) => { t.ifError(res); });
});

ava("resourceImplementOptionsMethod succeed if status is 200", (t) => {
  function handler(_, res){
    res.statusCode = 200;
    res.end();
  }

  let testContext = { context: {
    resource: "/",
    agent: superTest(handler)
  } };

  restHalTestTools.resourceImplementOptionsMethod(testContext)
    .end((res) => { t.is(res, null); });
});
{'fraction_non_alphanumeric': 0.15645933014354066, 'fraction_numerical': 0.005741626794258373, 'mean_word_length': 4.2275, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '1361901', 'n_tokens_mistral': 635, 'n_tokens_neox': 625, 'n_words': 141}