Skip to content

Commit

Permalink
test(reference): fix File.uri prop in tests (#3569)
Browse files Browse the repository at this point in the history
  • Loading branch information
char0n authored Dec 21, 2023
1 parent 2a83fd6 commit 8c2e246
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ describe('parsers', function () {
context('parse', function () {
context('given API Design Systems JSON data', function () {
specify('should return parse result', async function () {
const url = path.join(__dirname, 'fixtures', 'api-design-systems.json');
const data = fs.readFileSync(url).toString();
const uri = path.join(__dirname, 'fixtures', 'api-design-systems.json');
const data = fs.readFileSync(uri).toString();
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest('json'),
});
Expand All @@ -115,10 +115,10 @@ describe('parsers', function () {

context('given API Design Systems JSON data as buffer', function () {
specify('should return parse result', async function () {
const url = path.join(__dirname, 'fixtures', 'api-design-systems.json');
const data = fs.readFileSync(url);
const uri = path.join(__dirname, 'fixtures', 'api-design-systems.json');
const data = fs.readFileSync(uri);
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest('json'),
});
Expand Down Expand Up @@ -163,10 +163,10 @@ describe('parsers', function () {
context('sourceMap', function () {
context('given sourceMap enabled', function () {
specify('should decorate ApiDOM with source maps', async function () {
const url = path.join(__dirname, 'fixtures', 'api-design-systems.json');
const data = fs.readFileSync(url).toString();
const uri = path.join(__dirname, 'fixtures', 'api-design-systems.json');
const data = fs.readFileSync(uri).toString();
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest(),
});
Expand All @@ -179,10 +179,10 @@ describe('parsers', function () {

context('given sourceMap disabled', function () {
specify('should not decorate ApiDOM with source maps', async function () {
const url = path.join(__dirname, 'fixtures', 'api-design-systems.json');
const data = fs.readFileSync(url).toString();
const uri = path.join(__dirname, 'fixtures', 'api-design-systems.json');
const data = fs.readFileSync(uri).toString();
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest(),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ describe('parsers', function () {
context('parse', function () {
context('given API Design Systems YAML data', function () {
specify('should return parse result', async function () {
const url = path.join(__dirname, 'fixtures', 'api-design-systems.yaml');
const data = fs.readFileSync(url).toString();
const file = File({ url, data, mediaType: mediaTypes.latest() });
const uri = path.join(__dirname, 'fixtures', 'api-design-systems.yaml');
const data = fs.readFileSync(uri).toString();
const file = File({ uri, data, mediaType: mediaTypes.latest() });
const parser = ApiDesignSystemsYamlParser();
const parseResult = await parser.parse(file);

Expand All @@ -140,9 +140,9 @@ describe('parsers', function () {

context('given API Design Systems YAML data as buffer', function () {
specify('should return parse result', async function () {
const url = path.join(__dirname, 'fixtures', 'api-design-systems.yaml');
const data = fs.readFileSync(url);
const file = File({ url, data, mediaType: mediaTypes.latest() });
const uri = path.join(__dirname, 'fixtures', 'api-design-systems.yaml');
const data = fs.readFileSync(uri);
const file = File({ uri, data, mediaType: mediaTypes.latest() });
const parser = ApiDesignSystemsYamlParser();
const parseResult = await parser.parse(file);

Expand Down Expand Up @@ -184,10 +184,10 @@ describe('parsers', function () {
context('sourceMap', function () {
context('given sourceMap enabled', function () {
specify('should decorate ApiDOM with source maps', async function () {
const url = path.join(__dirname, 'fixtures', 'api-design-systems.yaml');
const data = fs.readFileSync(url).toString();
const uri = path.join(__dirname, 'fixtures', 'api-design-systems.yaml');
const data = fs.readFileSync(uri).toString();
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest(),
});
Expand All @@ -200,10 +200,10 @@ describe('parsers', function () {

context('given sourceMap disabled', function () {
specify('should not decorate ApiDOM with source maps', async function () {
const url = path.join(__dirname, 'fixtures', 'api-design-systems.yaml');
const data = fs.readFileSync(url).toString();
const uri = path.join(__dirname, 'fixtures', 'api-design-systems.yaml');
const data = fs.readFileSync(uri).toString();
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest(),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ describe('parsers', function () {
context('parse', function () {
context('given AsyncApi 2.6.0 JSON data', function () {
specify('should return parse result', async function () {
const url = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(url).toString();
const uri = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(uri).toString();
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest('json'),
});
Expand All @@ -113,10 +113,10 @@ describe('parsers', function () {

context('given AsyncApi 2.6.0 JSON data as buffer', function () {
specify('should return parse result', async function () {
const url = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(url);
const uri = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(uri);
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest('json'),
});
Expand Down Expand Up @@ -161,10 +161,10 @@ describe('parsers', function () {
context('sourceMap', function () {
context('given sourceMap enabled', function () {
specify('should decorate ApiDOM with source maps', async function () {
const url = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(url).toString();
const uri = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(uri).toString();
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest(),
});
Expand All @@ -177,10 +177,10 @@ describe('parsers', function () {

context('given sourceMap disabled', function () {
specify('should not decorate ApiDOM with source maps', async function () {
const url = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(url).toString();
const uri = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(uri).toString();
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest(),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ describe('parsers', function () {
context('parse', function () {
context('given AsyncApi 2.6.0 YAML data', function () {
specify('should return parse result', async function () {
const url = path.join(__dirname, 'fixtures', 'sample-api.yaml');
const data = fs.readFileSync(url).toString();
const file = File({ url, data, mediaType: mediaTypes.latest() });
const uri = path.join(__dirname, 'fixtures', 'sample-api.yaml');
const data = fs.readFileSync(uri).toString();
const file = File({ uri, data, mediaType: mediaTypes.latest() });
const parser = AsyncApiYaml2Parser();
const parseResult = await parser.parse(file);

Expand All @@ -140,9 +140,9 @@ describe('parsers', function () {

context('given AsyncApi 2.6.0 YAML data as buffer', function () {
specify('should return parse result', async function () {
const url = path.join(__dirname, 'fixtures', 'sample-api.yaml');
const data = fs.readFileSync(url);
const file = File({ url, data, mediaType: mediaTypes.latest() });
const uri = path.join(__dirname, 'fixtures', 'sample-api.yaml');
const data = fs.readFileSync(uri);
const file = File({ uri, data, mediaType: mediaTypes.latest() });
const parser = AsyncApiYaml2Parser();
const parseResult = await parser.parse(file);

Expand Down Expand Up @@ -184,10 +184,10 @@ describe('parsers', function () {
context('sourceMap', function () {
context('given sourceMap enabled', function () {
specify('should decorate ApiDOM with source maps', async function () {
const url = path.join(__dirname, 'fixtures', 'sample-api.yaml');
const data = fs.readFileSync(url).toString();
const uri = path.join(__dirname, 'fixtures', 'sample-api.yaml');
const data = fs.readFileSync(uri).toString();
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest(),
});
Expand All @@ -200,10 +200,10 @@ describe('parsers', function () {

context('given sourceMap disabled', function () {
specify('should not decorate ApiDOM with source maps', async function () {
const url = path.join(__dirname, 'fixtures', 'sample-api.yaml');
const data = fs.readFileSync(url).toString();
const uri = path.join(__dirname, 'fixtures', 'sample-api.yaml');
const data = fs.readFileSync(uri).toString();
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest(),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ describe('parsers', function () {
context('parse', function () {
context('given OpenApi 2.0 JSON data', function () {
specify('should return parse result', async function () {
const url = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(url).toString();
const uri = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(uri).toString();
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest('json'),
});
Expand All @@ -113,10 +113,10 @@ describe('parsers', function () {

context('given OpenApi 2.0 JSON data as buffer', function () {
specify('should return parse result', async function () {
const url = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(url);
const uri = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(uri);
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest('json'),
});
Expand Down Expand Up @@ -161,10 +161,10 @@ describe('parsers', function () {
context('sourceMap', function () {
context('given sourceMap enabled', function () {
specify('should decorate ApiDOM with source maps', async function () {
const url = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(url).toString();
const uri = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(uri).toString();
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest('json'),
});
Expand All @@ -177,10 +177,10 @@ describe('parsers', function () {

context('given sourceMap disabled', function () {
specify('should not decorate ApiDOM with source maps', async function () {
const url = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(url).toString();
const uri = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(uri).toString();
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest('json'),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ describe('parsers', function () {
context('parse', function () {
context('given OpenApi 3.0.x JSON data', function () {
specify('should return parse result', async function () {
const url = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(url).toString();
const uri = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(uri).toString();
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest('json'),
});
Expand All @@ -113,10 +113,10 @@ describe('parsers', function () {

context('given OpenApi 3.0.x JSON data as buffer', function () {
specify('should return parse result', async function () {
const url = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(url);
const uri = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(uri);
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest('json'),
});
Expand Down Expand Up @@ -161,10 +161,10 @@ describe('parsers', function () {
context('sourceMap', function () {
context('given sourceMap enabled', function () {
specify('should decorate ApiDOM with source maps', async function () {
const url = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(url).toString();
const uri = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(uri).toString();
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest('json'),
});
Expand All @@ -177,10 +177,10 @@ describe('parsers', function () {

context('given sourceMap disabled', function () {
specify('should not decorate ApiDOM with source maps', async function () {
const url = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(url).toString();
const uri = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(uri).toString();
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest('json'),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ describe('parsers', function () {
context('parse', function () {
context('given OpenApi 3.1.x JSON data', function () {
specify('should return parse result', async function () {
const url = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(url).toString();
const uri = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(uri).toString();
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest('json'),
});
Expand All @@ -113,10 +113,10 @@ describe('parsers', function () {

context('given OpenApi 3.1.x JSON data as buffer', function () {
specify('should return parse result', async function () {
const url = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(url);
const uri = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(uri);
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest('json'),
});
Expand Down Expand Up @@ -161,10 +161,10 @@ describe('parsers', function () {
context('sourceMap', function () {
context('given sourceMap enabled', function () {
specify('should decorate ApiDOM with source maps', async function () {
const url = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(url).toString();
const uri = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(uri).toString();
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest('json'),
});
Expand All @@ -177,10 +177,10 @@ describe('parsers', function () {

context('given sourceMap disabled', function () {
specify('should not decorate ApiDOM with source maps', async function () {
const url = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(url).toString();
const uri = path.join(__dirname, 'fixtures', 'sample-api.json');
const data = fs.readFileSync(uri).toString();
const file = File({
url,
uri,
data,
mediaType: mediaTypes.latest('json'),
});
Expand Down
Loading

0 comments on commit 8c2e246

Please sign in to comment.