Untitled
Anonymous
plain_text
02/17/2024 3:03 PM
812 B
27
Indexable
// PRODUCT SERVICE
describe('getAllProducts', function () {
it('should return all products', async function () {
const products: any = [
{ id: 1, name: 'Product 1', price: '10.00', userId: 1 },
{ id: 2, name: 'Product 2', price: '20.00', userId: 1 },
{ id: 3, name: 'Product 3', price: '30.00', userId: 2 },
];
const findAllStub = sinon.stub(ProductModel, 'findAll').resolves(products);
const result = await createProduct.getAllProducts();
expect(findAllStub.calledOnce).to.be.true;
expect(result).to.deep.equal(products);
});
});Editor is loading...
Leave a Comment