Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
tatomyr committed Apr 16, 2024
1 parent 5e9c0bc commit 57ccffa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extends:
- https://raw.githubusercontent.com/Redocly/redocly-cli-cookbook/main/rulesets/spec-compliant/redocly.yaml
14 changes: 14 additions & 0 deletions packages/core/src/config/__tests__/load.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { lintConfig } from '../../lint';
import { replaceSourceWithRef } from '../../../__tests__/utils';
import type { RuleConfig, FlatRawConfig } from './../types';
import type { NormalizedProblem } from '../../walk';
import { BaseResolver } from '../../resolve';

const fs = require('fs');
const path = require('path');
Expand Down Expand Up @@ -58,6 +59,19 @@ describe('loadConfig', () => {
});
expect(mockFn).toHaveBeenCalled();
});

it('should call externalRefResolver if such passed', async () => {
const externalRefResolver = new BaseResolver();
const resolverSpy = jest.spyOn(externalRefResolver, 'resolveDocument');
await loadConfig({
configPath: path.join(__dirname, './fixtures/load-external.yaml'),
externalRefResolver: externalRefResolver as any,
});
expect(resolverSpy).toHaveBeenCalledWith(
null,
'https://raw.githubusercontent.com/Redocly/redocly-cli-cookbook/main/rulesets/spec-compliant/redocly.yaml'
);
});
});

describe('findConfig', () => {
Expand Down

0 comments on commit 57ccffa

Please sign in to comment.