Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

api-testing

Package Overview
Dependencies
Maintainers
16
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-testing - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

6

lib/config.js

@@ -25,7 +25,7 @@ 'use strict';

} else {
// If config.local.json doesnt exist in root folder, throw helpful error
const localConfigFile = 'config.local.json';
// If .api-testing.config.json doesnt exist in root folder, throw helpful error
const localConfigFile = '.api-testing.config.json';
requireFile = `${baseDir}/${localConfigFile}`;
if (!fs.existsSync(requireFile)) {
throw Error(`Missing local config! Please create a ${localConfigFile} config using ${configsDir}/example.json as an example`);
throw Error(`Missing local config! Please create a ${localConfigFile} config`);
}

@@ -32,0 +32,0 @@ }

{
"name": "api-testing",
"version": "1.0.2",
"version": "1.0.3",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,6 +0,7 @@

# MediaWiki API integration tests
# API-Testing
This repo contains end-to-end integration tests for MediaWiki's [Action API](https://www.mediawiki.org/wiki/API:Main_page) and [REST API](https://www.mediawiki.org/wiki/API:REST_API).
The tests are implemented in JavaScript for node.js, using the
[supertest](https://www.npmjs.com/package/supertest)
API-Testing is a library for end-to-end integration tests for MediaWiki's
[Action API](https://www.mediawiki.org/wiki/API:Main_page) and [REST API](https://www.mediawiki.org/wiki/API:REST_API).
You can run tests locally by installing the NPM package and configuring it to access a test wiki or a service. The
library is implemented in JavaScript for node.js, using the [supertest](https://www.npmjs.com/package/supertest)
HTTP testing library, the [Chai](https://www.npmjs.com/package/chai) assertion

@@ -7,0 +8,0 @@ library, and the [Mocha](https://www.npmjs.com/package/mocha) testing framework.

@@ -11,3 +11,3 @@ const { assert, utils } = require('../index');

[`${testConfigsDir}/example.json`, `{ "file": "${testConfigsDir}/example.json" }`],
[`${testRootDir}/config.local.json`, `{ "file": "${testRootDir}/config.local.json" }`]
[`${testRootDir}/.api-testing.config.json`, `{ "file": "${testRootDir}/.api-testing.config.json" }`]
];

@@ -62,5 +62,5 @@

describe(`Using ${testRootDir} as the configuration root folder`, () => {
it('Use config.local.json file if API_TESTING_CONFIG_FILE does not exist', () => {
it('Use .api-testing.config.json file if API_TESTING_CONFIG_FILE does not exist', () => {
delete process.env.API_TESTING_CONFIG_FILE;
assert.deepEqual(getConfig(testRootDir), { file: `${testRootDir}/config.local.json` });
assert.deepEqual(getConfig(testRootDir), { file: `${testRootDir}/.api-testing.config.json` });
});

@@ -80,6 +80,6 @@

describe('Renaming required root folder config "config.local.json"', () => {
it('Throws exception if "config.local.json" doesnt exist and API_TESTING_CONFIG_FILE is not set', () => {
describe('Renaming required root folder config ".api-testing.config.json"', () => {
it('Throws exception if ".api-testing.config.json" doesnt exist and API_TESTING_CONFIG_FILE is not set', () => {
delete process.env.API_TESTING_CONFIG_FILE;
fs.rename(`${testRootDir}/config.local.json`, `${testRootDir}/wrong.json`, (err) => {
fs.rename(`${testRootDir}/.api-testing.config.json`, `${testRootDir}/wrong.json`, (err) => {
assert.throws(() => getConfig(testRootDir), Error, /Missing local config!/);

@@ -86,0 +86,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc