<commit_before>const env = require('./test-environment')
const db = require('../../../server/db/db')

let testDb = null

beforeEach(() => {
  testDb = env.getTestDb()
  return env.initialise(testDb)
})

afterEach(() => env.cleanup(testDb))

test('getUser gets users id', () => {
  return db.getUser(2, testDb)
    .then(user => {
      expect(user.id).toBe(2)
    })
})

test('getSprint gets sprint number', () => {
  return db.getSprint(1, testDb)
    .then(sprint => {
      expect(sprint.number).toBe(0)
    })
})

test('getAssignmentsBySprintId returns correct assignment', () => {
  return db.getAssignmentsBySprintId(1, testDb)
    .then(assignment => {
      expect(assignment[0].title).toBe('kimmis cookies')
    })
})

test('getTasksByAssignmentId returns correct task', () => {
  return db.getTasksByAssignmentId(3, testDb)
    .then(task => {
      expect(task[0].description).toBe('smiles')
    })
})

test('getAssignedTasks returns a boolean for complete', () => {
  return db.getAssignedTasks(1, 1, testDb)
    .then(assignedtask => {
      expect(assignedtask[0].user_id).toBe(1)
    })
})
<commit_msg>added getSprints function<commit_after>const env = require('./test-environment')
const db = require('../../../server/db/db')

let testDb = null

beforeEach(() => {
  testDb = env.getTestDb()
  return env.initialise(testDb)
})

afterEach(() => env.cleanup(testDb))

test('getUser gets users id', () => {
  return db.getUserById(2, testDb)
    .then(user => {
      expect(user.id).toBe(2)
    })
})

test('getSprint gets sprint number', () => {
  return db.getSprintById(1, testDb)
    .then(sprint => {
      expect(sprint.number).toBe(0)
    })
})

test('getAssignmentsBySprintId returns correct assignment', () => {
  return db.getAssignmentsBySprintId(1, testDb)
    .then(assignment => {
      expect(assignment[0].title).toBe('kimmis cookies')
    })
})

test('getTasksByAssignmentId returns correct task', () => {
  return db.getTasksByAssignmentId(3, testDb)
    .then(task => {
      expect(task[0].description).toBe('smiles')
    })
})

test('getAssignedTasks returns a boolean for complete', () => {
  return db.getAssignedTasks(1, 1, testDb)
    .then(assignedtask => {
      expect(assignedtask[0].user_id).toBe(1)
    })
})

{'fraction_non_alphanumeric': 0.18012422360248448, 'fraction_numerical': 0.01064773735581189, 'mean_word_length': 3.7274633123689727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, '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': '6935708', 'n_tokens_mistral': 777, 'n_tokens_neox': 778, 'n_words': 132}