<commit_before>'use strict';

require('dotenv').config({path: `${__dirname}/../.test.env`});
const superagent = require('superagent');
const expect = require('expect');
const faker = require('faker');
const clearDB = require('./lib/clearDB.js');
const mockGuardian = require('./lib/mock-guardian.js');
const mockUser = require('./lib/mock-user.js');
const server = require('../lib/server.js');
const API_URL = process.env.API_URL;

describe('testing guardian-routes', () => {
  before(server.start);
  after(server.stop);
  afterEach(clearDB);
  describe('testing POST at /api/guardians', () => {
    it('should return a POST 200 and returns the created guardian', () => {
      let tempUser;
      mockUser.createOne()
        .then((user) => {
          tempUser = user;
          let tempGuardian = {
            firstName: faker.name.firstName(),
            lastName: faker.name.lastName(),
            email: tempUser.user.email,
            city: faker.address.city(),
            state: faker.address.stateAbbr(),
            service: faker.company.bsBuzz(),
            phoneNumber: faker.phone.phoneNumber(),
            userID: tempUser.user._id.toString(),
          };
          return superagent.post(`${API_URL}/api/guardians`)
            .set('Authorization', `Bearer ${user.token}`)<commit_msg>think it's async issue<commit_after>'use strict';

require('dotenv').config({path: `${__dirname}/../.test.env`});
const superagent = require('superagent');
const expect = require('expect');
const faker = require('faker');
const clearDB = require('./lib/clearDB.js');
// const mockGuardian = require('./lib/mock-guardian.js');
const mockUser = require('./lib/mock-user.js');
const server = require('../lib/server.js');
const API_URL = process.env.API_URL;

describe('testing guardian-routes', () => {
  before(server.start);
  after(server.stop);
  afterEach(clearDB);
  describe('testing POST at /api/guardians', () => {
    it('should return a POST 200 and returns the created guardian', () => {
      let tempUser;
      mockUser.createOne()
        .then((user) => {
          tempUser = user;
          let tempGuardian = {
            firstName: faker.name.firstName(),
            lastName: faker.name.lastName(),
            email: tempUser.user.email,
            city: faker.address.city(),
            state: faker.address.stateAbbr(),
            service: faker.company.bsBuzz(),
            phoneNumber: faker.phone.phoneNumber(),
            userID: tempUser.user._id.toString(),
          };
          return superagent.post(`${API_URL}/api/guardians`)
            .set('Authorization', `Bearer ${user.token}`)
{'fraction_non_alphanumeric': 0.16805766312594841, 'fraction_numerical': 0.002276176024279211, 'mean_word_length': 2.8722466960352424, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '748944', 'n_tokens_mistral': 785, 'n_tokens_neox': 771, 'n_words': 154}