Sneha Singh
09/08/2022, 7:36 AM'use strict'
process.env.REACT_APP_ENGINE_SERVICE_URL = '<http://localhost:8992>'
import path from 'path'
import { Pact } from '@pact-foundation/pact'
import { fetchACEFields } from '../api/index'
const port = 8992
const objectType = 'dummy'
const provider = new Pact({
port: port,
log: path.resolve(process.cwd(), 'logs', 'mockserver-integration.log'),
dir: path.resolve(process.cwd(), 'pacts'),
spec: 2,
consumer: 'webapp',
provider: 'engine-service',
pactfileWriteMode: 'merge',
})
describe('fetch ACE fields', () => {
const expectedBody = { status: true, data: [{ fullName: 'dummy' }] }
beforeAll(async () => {
await provider.setup();
});
describe('request to fetch ACE fields', () => {
beforeAll(async () => {
await provider.addInteraction({
state: 'fetch ace fields',
uponReceiving: 'a request to get all ace fields',
withRequest: {
method: 'GET',
path: `/ace-fields?object_type=${objectType}`,
headers: {
Accept: 'application/json',
},
},
willRespondWith: {
status: 200,
headers: {
'Content-Type': 'application/json',
},
body: expectedBody,
},
});
});
test('verify it returns the correct response', async () => {
const res = await fetchACEFields(objectType)
expect(res).toBe(expectedBody)
})
})
})
Matt (pactflow.io / pact-js / pact-go)
cors
flag (also this looks to be a JS question, could you please add future JS questions in #C9VBGLUM9?)Matt (pactflow.io / pact-js / pact-go)
Sneha Singh
09/08/2022, 12:10 PMTimothy Jones
09/08/2022, 12:26 PMTimothy Jones
09/08/2022, 12:27 PMTimothy Jones
09/08/2022, 12:28 PMSneha Singh
09/08/2022, 12:48 PMTimothy Jones
09/08/2022, 12:54 PMTimothy Jones
09/08/2022, 12:55 PMMatt (pactflow.io / pact-js / pact-go)
Timothy Jones
09/08/2022, 2:03 PMnavigator not defined