feat(medusa): Add /admin/products/:id/variants end point (#1471)
* feat(medusa): Add /admin/products/:id/variants end point * test(medusa): Fix get-variants test casees * feat(medusa): Include the config to the ProdutService#retrieveVariants as a method parameter * feat(medusa): Improve get-variants endpoint * feat(medusa): Improve get-variants endpoint * test(medusa): Fix unit tests * test(medusa): Fix unit tests * feat(medusa): Improve typings * feat(medusa): Update according to feedback * feat(medusa): Update according to feedback * test(medusa): Fix list-variants tests * feat(medusa): Getting the variants from the product end point should use the productVariantService * fix(medusa): list-variants expand possibly undefined * Fix(medusa): List-variants endpoint * fix(medusa): Tests suite for list-variant * test(integration-tests): Fix yarn lock * test(integration-tests): Fix yarn lock
This commit is contained in:
@@ -4,6 +4,7 @@ import jwt from "jsonwebtoken"
|
||||
import { MockManager } from "medusa-test-utils"
|
||||
import "reflect-metadata"
|
||||
import supertest from "supertest"
|
||||
import querystring from "querystring"
|
||||
import apiLoader from "../loaders/api"
|
||||
import passportLoader from "../loaders/passport"
|
||||
import servicesLoader from "../loaders/services"
|
||||
@@ -68,10 +69,10 @@ apiLoader({ container, app: testApp, configModule: config })
|
||||
const supertestRequest = supertest(testApp)
|
||||
|
||||
export async function request(method, url, opts = {}) {
|
||||
let { payload, headers } = opts
|
||||
const { payload, query, headers = {} } = opts
|
||||
|
||||
const req = supertestRequest[method.toLowerCase()](url)
|
||||
headers = headers || {}
|
||||
const queryParams = query && querystring.stringify(query);
|
||||
const req = supertestRequest[method.toLowerCase()](`${url}${queryParams ? "?" + queryParams : ''}`)
|
||||
headers.Cookie = headers.Cookie || ""
|
||||
if (opts.adminSession) {
|
||||
if (opts.adminSession.jwt) {
|
||||
|
||||
Reference in New Issue
Block a user