import {expect} from "chai" import { runGQL } from "../e2e_helper"; describe('Check send order', function () { let headers = { 'x-device-id': '123testDeviceId', } it('Create new', async () => { const query = `#graphql {order(orderId:"test-cart"){ id total }}`; const result = await runGQL(query, headers); expect(result.errors).to.be.undefined; }); it('orderAddDish', async () => { const query = `#graphql mutation{orderAddDish(dishId: "df19cbbc-c026-595e-9296-1c8a378da6b3", orderId:"test-cart", amount: 1){ dishes { dish { id name price } itemTotal } total }} `; const result = await runGQL(query, headers); expect(result.data.orderAddDish.dishes[0].dish.id).to.equal("df19cbbc-c026-595e-9296-1c8a378da6b3"); }); it('checkOrder', async () => { const query = `#graphql mutation{checkOrder(orderCheckout: { orderId: "test-cart", paymentMethodId: "", address: { city: "town", street: "test", home: "123" }, customer: { phone: { code: "+1", number: "0000000000" }, name: "Piter Parker" } }) { order { id state dishes{ dish { name id } } } message { title message } }} `; const result = await runGQL(query, headers); expect(result.data.checkOrder.order.dishes[0].dish.id).to.equal("df19cbbc-c026-595e-9296-1c8a378da6b3"); }); it('sendOrder', async () => { const query = ` mutation{sendOrder(orderId:"test-cart") { order { id state dishes{ dish { name id } amount } } message { title message } }} `; const result = await runGQL(query, headers); expect(result.data.sendOrder.order.state).to.equal("ORDER"); }); });