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

@fluffy-spoon/substitute

Package Overview
Dependencies
Maintainers
1
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fluffy-spoon/substitute - npm Package Compare versions

Comparing version 1.0.64 to 1.0.65

5

dist/spec/index.test.d.ts

@@ -0,1 +1,3 @@

declare class Dummy {
}
export declare class Example {

@@ -7,4 +9,5 @@ a: string;

received(stuff: number | string): void;
returnPromise(): Promise<number>;
returnPromise(): Promise<Dummy>;
foo(): string;
}
export {};

23

dist/spec/index.test.js

@@ -42,2 +42,7 @@ "use strict";

var Utilities_1 = require("../src/Utilities");
var Dummy = /** @class */ (function () {
function Dummy() {
}
return Dummy;
}());
var Example = /** @class */ (function () {

@@ -67,3 +72,3 @@ function Example() {

Example.prototype.returnPromise = function () {
return Promise.resolve(1337);
return Promise.resolve(new Dummy());
};

@@ -85,2 +90,18 @@ Example.prototype.foo = function () {

});
ava_1.default('returning other fake from promise works', function (t) { return __awaiter(_this, void 0, void 0, function () {
var otherSubstitute, _a, _b, _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
otherSubstitute = Index_1.Substitute.for();
substitute.returnPromise().returns(Promise.resolve(otherSubstitute));
_b = (_a = t).is;
_c = [otherSubstitute];
return [4 /*yield*/, substitute.returnPromise()];
case 1:
_b.apply(_a, _c.concat([_d.sent()]));
return [2 /*return*/];
}
});
}); });
ava_1.default('returning resolved promises works', function (t) { return __awaiter(_this, void 0, void 0, function () {

@@ -87,0 +108,0 @@ var _a, _b, _c;

@@ -156,2 +156,4 @@ "use strict";

return function () { return thisProxy; };
if (property === 'then')
return void 0;
var currentPropertyContext = objectContext.property;

@@ -158,0 +160,0 @@ var addPropertyToObjectContext = function () {

{
"name": "@fluffy-spoon/substitute",
"version": "1.0.64",
"version": "1.0.65",
"description": "An NSubstitute port to TypeScript called substitute.js.",

@@ -5,0 +5,0 @@ "main": "dist/src/Index.js",

@@ -7,2 +7,6 @@ import test from 'ava';

class Dummy {
}
export class Example {

@@ -28,3 +32,3 @@ a = "1337";

returnPromise() {
return Promise.resolve(1337);
return Promise.resolve(new Dummy());
}

@@ -49,2 +53,9 @@

test('returning other fake from promise works', async t => {
const otherSubstitute = Substitute.for<Dummy>();
substitute.returnPromise().returns(Promise.resolve(otherSubstitute));
t.is(otherSubstitute, await substitute.returnPromise());
});
test('returning resolved promises works', async t => {

@@ -51,0 +62,0 @@ substitute.returnPromise().returns(Promise.resolve(1338));

@@ -177,2 +177,5 @@ import { ObjectSubstitute, OmitProxyMethods, DisabledSubstituteObject } from "./Transformations";

if(property === 'then')
return void 0;
const currentPropertyContext = objectContext.property;

@@ -179,0 +182,0 @@ const addPropertyToObjectContext = () => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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