Skip to content

Commit

Permalink
feat: moving out integration test suite over to using native fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
erunion committed Jun 16, 2024
1 parent 572b4c2 commit d11b4eb
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 31 deletions.
16 changes: 0 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@
"alex": "^11.0.0",
"caseless": "^0.12.0",
"eslint": "^8.27.0",
"form-data-encoder": "^2.1.0",
"formdata-node": "^5.0.0",
"har-validator": "^5.1.5",
"isomorphic-fetch": "^3.0.0",
"lerna": "^8.1.3",
"prettier": "^3.0.2",
"vitest": "^0.34.2"
Expand Down
14 changes: 2 additions & 12 deletions test/integration-metrics.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@ import { once } from 'node:events';
import fs from 'node:fs/promises';
import http from 'node:http';
import net from 'node:net';
import { Readable } from 'node:stream';

import chai from 'chai';
import { FormDataEncoder } from 'form-data-encoder';
import { File, FormData } from 'formdata-node';
import 'isomorphic-fetch';
import { describe, beforeAll, beforeEach, afterAll, expect, it, expectTypeOf } from 'vitest';

import chaiPlugins from './helpers/chai-plugins.js';
Expand Down Expand Up @@ -462,12 +458,9 @@ describe('Metrics SDK Integration Tests', function () {
formData.append('another', 'Hello world');
formData.append('buster', [1234, 5678]);

const encoder = new FormDataEncoder(formData);

await fetch(`http://localhost:${PORT}/`, {
method: 'post',
headers: encoder.headers,
body: Readable.from(encoder),
body: formData,
});

const [, body] = await getRequest();
Expand Down Expand Up @@ -505,12 +498,9 @@ describe('Metrics SDK Integration Tests', function () {
formData.append('buster', [1234, 5678]);
formData.append('owlbert.png', new File([owlbert], 'owlbert.png', { type: 'image/png' }), 'owlbert.png');

const encoder = new FormDataEncoder(formData);

await fetch(`http://localhost:${PORT}/`, {
method: 'post',
headers: encoder.headers,
body: Readable.from(encoder),
body: formData,
});

const [, body] = await getRequest();
Expand Down

0 comments on commit d11b4eb

Please sign in to comment.