Skip to content

Commit

Permalink
chore(test): remove content-type workarounds post fix in pact-ref
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed Jun 20, 2024
1 parent 1d35c82 commit 9721d29
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
8 changes: 1 addition & 7 deletions examples/v3/todo-consumer/src/todo.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ const parser = new XMLParser({
ignoreAttributes: false,
});
let serverUrl = 'http://127.0.0.1:2203';
const HasBinaryPayloadIssue =
process.platform === 'win32' ||
(process.platform === 'darwin' && process.arch === 'arm64') ||
(process.platform === 'linux' && process.arch === 'arm64');

module.exports = {
getProjects: async (format = 'json') => {
Expand Down Expand Up @@ -44,9 +40,7 @@ module.exports = {
const data = fs.readFileSync(image);
return axios.post(serverUrl + '/projects/' + id + '/images', data, {
headers: {
'Content-Type': HasBinaryPayloadIssue
? 'application/octet-stream'
: 'image/jpeg',
'Content-Type': 'image/jpeg',
},
});
},
Expand Down
7 changes: 1 addition & 6 deletions examples/v3/todo-consumer/test/consumer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ const LOG_LEVEL = process.env.LOG_LEVEL || 'TRACE';

const TodoApp = require('../src/todo');
const expect = chai.expect;
const HasBinaryPayloadIssue =
process.platform === 'win32' ||
(process.platform === 'darwin' && process.arch === 'arm64') ||
(process.platform === 'linux' && process.arch === 'arm64');
chai.use(chaiAsPromised);

describe('Pact V3', () => {
Expand Down Expand Up @@ -148,15 +144,14 @@ describe('Pact V3', () => {
});
});

// See https://github.com/pact-foundation/pact-reference/issues/171 for why it's skipped
describe('with image uploads', () => {
before(() => {
provider
.given('i have a project', { id: '1001', name: 'Home Chores' })
.uponReceiving('a request to store an image against the project')
.withRequestBinaryFile(
{ method: 'POST', path: '/projects/1001/images' },
HasBinaryPayloadIssue ? 'application/octet-stream' : 'image/jpeg',
'image/jpeg',
path.resolve(__dirname, 'example.jpg')
)
.willRespondWith({ status: 201 });
Expand Down

0 comments on commit 9721d29

Please sign in to comment.