<commit_before>import { describe, beforeEach, afterEach, it } from 'global'
import { begin, expect, rollback } from '../__test__'
import { structs } from './__fixtures__'
import inventoryItemsData from './inventory-items-data'

describe('inventoryItemsData', () => {

  let trx
  let inventoryItems

  beforeEach(begin(_trx => {
    trx = _trx
    inventoryItems = inventoryItemsData(trx)
  }))

  afterEach(() => rollback(trx))

  describe('create', () => {
    const item = {
      sku: 'widget',
      description: 'A quality widget.',
      revenueCode: '4100',
      costCode: '5000',
      assetCode: '1300'
    }
    it('creates a inventory item', async () => {
      const created = await inventoryItems.create(item)
      expect(created).to.have.structure(structs.InventoryItem)
    })
  })

  describe('find', () => {
    it('lists all inventory items', async () => {
      const list = await inventoryItems.find()
      expect(list).to.have.length.above(0)
      expect(list).to.have.structure([structs.InventoryItem])
    })
  })

})<commit_msg>Adds assertion for new inventory item quantity on hand, on PO, on SO, and active status. #11<commit_after>import { describe, beforeEach, afterEach, it } from 'global'
import { begin, expect, rollback } from '../__test__'
import { structs } from './__fixtures__'
import inventoryItemsData from './inventory-items-data'

describe('inventoryItemsData', () => {

  let trx
  let inventoryItems

  beforeEach(begin(_trx => {
    trx = _trx
    inventoryItems = inventoryItemsData(trx)
  }))

  afterEach(() => rollback(trx))

  describe('create', () => {
    const item = {
      sku: 'widget',
      description: 'A quality widget.',
      revenueCode: '4100',
      costCode: '5000',
      assetCode: '1300'
    }
    it('creates a inventory item', async () => {
      const created = await inventoryItems.create(item)
      expect(created).to.have.structure(structs.InventoryItem)
      expect(created).to.include({
        quantityOnPurchaseOrder: 0,
        quantityOnSalesOrder: 0,
        quantityOnHand: 0,
        isActive: true
      })
    })
  })

  describe('find', () => {
    it('lists all inventory items', async () => {
      const list = await inventoryItems.find()
      expect(list).to.have.length.above(0)
      expect(list).to.have.structure([structs.InventoryItem])
    })
  })

})
{'fraction_non_alphanumeric': 0.1468590831918506, 'fraction_numerical': 0.013157894736842105, 'mean_word_length': 3.1496478873239435, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '5617215', 'n_tokens_mistral': 755, 'n_tokens_neox': 722, 'n_words': 165}