New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@bonniernews/fake-tool-api

Package Overview
Dependencies
Maintainers
0
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bonniernews/fake-tool-api - npm Package Compare versions

Comparing version 1.0.11 to 1.1.0

20

index.js

@@ -14,2 +14,3 @@ import nock from "nock";

const singleContentRegex = /^\/([\w-]+)\/([\w-]+)$/;
const workingCopyRegex = /^\/([\w-]+)\/([\w-]+)\/working-copy$/;
const putContentRegex = /^\/([\w-]+)\/([\w-]+)\??([^&]*)$/;

@@ -68,2 +69,4 @@ const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89abcd][0-9a-f]{3}-[0-9a-f]{12}$/i;

.reply(interceptable(getContent))
.get(workingCopyRegex)
.reply(interceptable(getWorkingCopy))
.put(putContentRegex)

@@ -85,4 +88,6 @@ .reply(interceptable(putContent))

// resets content an initialize basic types ()
let workingCopiesByType = {};
export function resetContent() {
initBasetypes();
workingCopiesByType = {};
slugs = [];

@@ -101,2 +106,10 @@ interceptor = () => { };

export function addWorkingCopy(type, id, content) {
if (!workingCopiesByType[type]) {
workingCopiesByType[type] = {};
}
workingCopiesByType[type][id] = { created: new Date().toISOString(), updated: new Date().toISOString(), ...content };
}
export async function addContent(type, id, content, skipEvents) {

@@ -464,2 +477,9 @@ if (!contentByType[type]) {

function getWorkingCopy(url) {
const matches = url.match(workingCopyRegex);
const [ , type, id ] = matches || [];
const workingCopy = workingCopiesByType[type]?.[id];
return workingCopy ? [ 200, workingCopy ] : [ 404 ];
}
function getContent(url) {

@@ -466,0 +486,0 @@ const matches = url.match(singleContentRegex);

4

package.json
{
"name": "@bonniernews/fake-tool-api",
"version": "1.0.11",
"version": "1.1.0",
"type": "module",

@@ -29,2 +29,2 @@ "description": "Mocked Bonnier News tool api, for use in automated tests",

}
}
}
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