Skip to content

Commit

Permalink
test: add test for data URLs
Browse files Browse the repository at this point in the history
Refs #2381
  • Loading branch information
char0n committed Sep 12, 2023
1 parent cd8b525 commit 9f7e0bc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/http/data-url.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import path from 'node:path';
import fs from 'node:fs';

const data = fs.readFileSync(path.join(__dirname, '../data/petstore.json')).toString('base64');
const dataURL = `data:application/json;base64,${data}`;

test('should support data URLs', async () => {
const response = await fetch(dataURL);
const jsonBody = await response.json();

expect(jsonBody).toHaveProperty('swagger', '2.0');
});

0 comments on commit 9f7e0bc

Please sign in to comment.