Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(reference): fix File.uri prop in tests #3569

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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