Skip to content

Commit

Permalink
Fix loadJsonFixture
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergei Zharinov committed Apr 23, 2021
1 parent 8682cdd commit b10be23
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 22 deletions.
5 changes: 4 additions & 1 deletion lib/config/presets/index.spec.ts
Expand Up @@ -16,7 +16,10 @@ jest.mock('./local');
const npm = mocked(_npm);
const local = mocked(_local);

const presetIkatyang = loadJsonFixture('renovate-config-ikatyang.json');
const presetIkatyang = loadJsonFixture(
__filename,
'renovate-config-ikatyang.json'
);

npm.getPreset = jest.fn(({ packageName, presetName }) => {
if (packageName === 'renovate-config-ikatyang') {
Expand Down
2 changes: 1 addition & 1 deletion lib/datasource/dart/index.spec.ts
Expand Up @@ -3,7 +3,7 @@ import * as httpMock from '../../../test/http-mock';
import { getName, loadJsonFixture } from '../../../test/util';
import { id as datasource } from '.';

const body = loadJsonFixture('shared_preferences.json');
const body = loadJsonFixture(__filename, 'shared_preferences.json');

const baseUrl = 'https://pub.dartlang.org/api/packages/';

Expand Down
2 changes: 1 addition & 1 deletion lib/datasource/gradle-version/index.spec.ts
Expand Up @@ -5,7 +5,7 @@ import { ExternalHostError } from '../../types/errors/external-host-error';
import { id as versioning } from '../../versioning/gradle';
import { id as datasource, getReleases } from '.';

const allResponse: any = loadJsonFixture('all.json');
const allResponse: any = loadJsonFixture(__filename, 'all.json');

let config: GetPkgReleasesConfig;

Expand Down
2 changes: 1 addition & 1 deletion lib/datasource/hex/index.spec.ts
Expand Up @@ -7,7 +7,7 @@ import { id as datasource } from '.';

const hostRules: any = _hostRules;

const res1 = loadJsonFixture('certifi.json');
const res1 = loadJsonFixture(__filename, 'certifi.json');

jest.mock('../../util/host-rules');

Expand Down
10 changes: 8 additions & 2 deletions lib/datasource/jenkins-plugins/index.spec.ts
Expand Up @@ -5,8 +5,14 @@ import * as versioning from '../../versioning/docker';
import { resetCache } from './get';
import * as jenkins from '.';

const jenkinsPluginsVersions = loadJsonFixture('plugin-versions.json');
const jenkinsPluginsInfo = loadJsonFixture('update-center.actual.json');
const jenkinsPluginsVersions = loadJsonFixture(
__filename,
'plugin-versions.json'
);
const jenkinsPluginsInfo = loadJsonFixture(
__filename,
'update-center.actual.json'
);

describe(getName(__filename), () => {
describe('getReleases', () => {
Expand Down
6 changes: 3 additions & 3 deletions lib/datasource/packagist/index.spec.ts
Expand Up @@ -10,9 +10,9 @@ jest.mock('../../util/host-rules');

const hostRules = _hostRules;

const includesJson: any = loadJsonFixture('includes.json');
const beytJson: any = loadJsonFixture('1beyt.json');
const mailchimpJson: any = loadJsonFixture('mailchimp-api.json');
const includesJson: any = loadJsonFixture(__filename, 'includes.json');
const beytJson: any = loadJsonFixture(__filename, '1beyt.json');
const mailchimpJson: any = loadJsonFixture(__filename, 'mailchimp-api.json');

const baseUrl = 'https://packagist.org';

Expand Down
4 changes: 2 additions & 2 deletions lib/datasource/rubygems/index.spec.ts
Expand Up @@ -6,8 +6,8 @@ import { resetCache } from './get-rubygems-org';
import * as rubygems from '.';

const rubygemsOrgVersions = loadFixture(__filename, 'rubygems-org.txt');
const railsInfo = loadJsonFixture('rails/info.json');
const railsVersions = loadJsonFixture('rails/versions.json');
const railsInfo = loadJsonFixture(__filename, 'rails/info.json');
const railsVersions = loadJsonFixture(__filename, 'rails/versions.json');

describe(getName(__filename), () => {
describe('getReleases', () => {
Expand Down
Expand Up @@ -3,8 +3,8 @@ import { findDepConstraints } from './dep-constraints';

jest.mock('../../../../util/fs');

const packageJson = loadJsonFixture('package.json');
const packageLockJson = loadJsonFixture('package-lock.json');
const packageJson = loadJsonFixture(__filename, 'package.json');
const packageLockJson = loadJsonFixture(__filename, 'package-lock.json');

describe(getName(__filename), () => {
describe('findDepConstraints()', () => {
Expand Down
Expand Up @@ -3,7 +3,7 @@ import { getLockedDependencies } from './get-locked';

jest.mock('../../../../util/fs');

const packageLockJson = loadJsonFixture('package-lock.json');
const packageLockJson = loadJsonFixture(__filename, 'package-lock.json');

describe(getName(__filename), () => {
describe('getLockedDependencies()', () => {
Expand Down
Expand Up @@ -2,7 +2,7 @@ import * as httpMock from '../../../../../test/http-mock';
import { getName, loadJsonFixture } from '../../../../../test/util';
import { findFirstParentVersion } from './parent-version';

const expressJson = loadJsonFixture('express.json');
const expressJson = loadJsonFixture(__filename, 'express.json');

describe(getName(__filename), () => {
describe('getLockedDependencies()', () => {
Expand Down
22 changes: 15 additions & 7 deletions lib/workers/repository/process/lookup/index.spec.ts
Expand Up @@ -30,15 +30,23 @@ jest.mock('../../../../datasource/github-releases');

const fixtureRoot = '../../../../config/npm';
const qJson = {
...loadJsonFixture('01.json', fixtureRoot),
...loadJsonFixture(__filename, '01.json', fixtureRoot),
latestVersion: '1.4.1',
};
const helmetJson = loadJsonFixture('02.json', fixtureRoot);
const coffeelintJson = loadJsonFixture('coffeelint.json', fixtureRoot);
const nextJson = loadJsonFixture('next.json', fixtureRoot);
const typescriptJson = loadJsonFixture('typescript.json', fixtureRoot);
const vueJson = loadJsonFixture('vue.json', fixtureRoot);
const webpackJson = loadJsonFixture('webpack.json', fixtureRoot);
const helmetJson = loadJsonFixture(__filename, '02.json', fixtureRoot);
const coffeelintJson = loadJsonFixture(
__filename,
'coffeelint.json',
fixtureRoot
);
const nextJson = loadJsonFixture(__filename, 'next.json', fixtureRoot);
const typescriptJson = loadJsonFixture(
__filename,
'typescript.json',
fixtureRoot
);
const vueJson = loadJsonFixture(__filename, 'vue.json', fixtureRoot);
const webpackJson = loadJsonFixture(__filename, 'webpack.json', fixtureRoot);

const docker = mocked(datasourceDocker) as any;
docker.defaultRegistryUrls = ['https://index.docker.io'];
Expand Down

0 comments on commit b10be23

Please sign in to comment.