Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
870 B
3
Indexable
Never
const { FIRST_SALE_MOCK,
  SALES_MOCK,
  SALE_NOT_FOUND_MOCK,
  INSERT_ONE_SALE_MOCK,
  INSERT_TWO_SALES_MOCK,
  RESULT_INSERT_ONE_SALE_MOCK,
  RESULT_INSERT_TWO_SALES_MOCK,
} = require('../mocks/sales.mock');

  it('Deve ser possível inserir uma sale', async function () {
    const stub = sinon.stub(salesModel, 'insertNewSale').returns(RESULT_INSERT_ONE_SALE_MOCK);
    const product = await salesModel.insertNewSale(INSERT_ONE_SALE_MOCK);

    expect(product).to.be.deep.equal(RESULT_INSERT_ONE_SALE_MOCK);
    stub.restore();
  });

  it('Deve ser possível inserir duas sales', async function () {
    const stub = sinon.stub(salesModel, 'insertNewSale').returns(RESULT_INSERT_TWO_SALES_MOCK);
    const product = await salesModel.insertNewSale(INSERT_TWO_SALES_MOCK);

    expect(product).to.be.deep.equal(RESULT_INSERT_TWO_SALES_MOCK);
    stub.restore();
  });
Leave a Comment