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

passport-mock-strategy

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passport-mock-strategy - npm Package Compare versions

Comparing version 1.1.1 to 2.0.0

7

lib/create-mock-passport.d.ts

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

/// <reference types="express" />
/// <reference types="passport" />
import { Application } from 'express';
import * as passport from 'passport';
import passport from 'passport';
/**

@@ -10,3 +8,2 @@ * Sets up a basic passport configuration using the default MockPassport instance.

*/
declare function createMockPassport(app: Application): passport.Authenticator;
export = createMockPassport;
export default function createMockPassport(app: Application): passport.Authenticator;
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var passport = __importStar(require("passport"));
Object.defineProperty(exports, "__esModule", { value: true });
var passport_1 = __importDefault(require("passport"));
var mock_utilities_1 = require("./mock-utilities");
var MockStrategy = require("./passport-mock-strategy");
var passport_mock_strategy_1 = __importDefault(require("./passport-mock-strategy"));
/**

@@ -18,8 +15,8 @@ * Sets up a basic passport configuration using the default MockPassport instance.

function createMockPassport(app) {
var mockPassport = new passport.Passport();
var mockPassport = new passport_1.default.Passport();
mock_utilities_1.setupSerializeAndDeserialize(mockPassport);
mockPassport.use(new MockStrategy());
mockPassport.use(new passport_mock_strategy_1.default());
mock_utilities_1.connectPassport(app, mockPassport);
return mockPassport;
}
module.exports = createMockPassport;
exports.default = createMockPassport;

@@ -1,15 +0,11 @@

import createMockPassport = require('./create-mock-passport');
import createMockStorage = require('./mock-storage');
import mockUser = require('./mock-user');
import { connectPassport, setupSerializeAndDeserialize } from './mock-utilities';
import Strategy = require('./passport-mock-strategy');
declare const _default: typeof Strategy & {
MockStrategy: typeof Strategy;
Strategy: typeof Strategy;
mockUser: mockUser.User;
setupSerializeAndDeserialize: typeof setupSerializeAndDeserialize;
connectPassport: typeof connectPassport;
createMockPassport: typeof createMockPassport;
createMockStorage: typeof createMockStorage;
};
export = _default;
import MockStrategy from './passport-mock-strategy';
/**
* Export everything.
*/
export { default as createMockPassport } from './create-mock-passport';
export { default as createMockStorage, MockStorage } from './mock-storage';
export { default as mockUser, User } from './mock-user';
export { connectPassport, setupSerializeAndDeserialize, SerializeFn, DeserializeFn, } from './mock-utilities';
export { MockStrategyOptions, DoneCallback, VerifyFunction, } from './passport-mock-strategy';
export { MockStrategy, MockStrategy as Strategy };
export default MockStrategy;
"use strict";
var createMockPassport = require("./create-mock-passport");
var createMockStorage = require("./mock-storage");
var mockUser = require("./mock-user");
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var passport_mock_strategy_1 = __importDefault(require("./passport-mock-strategy"));
exports.MockStrategy = passport_mock_strategy_1.default;
exports.Strategy = passport_mock_strategy_1.default;
/**
* Export everything.
*/
var create_mock_passport_1 = require("./create-mock-passport");
exports.createMockPassport = create_mock_passport_1.default;
var mock_storage_1 = require("./mock-storage");
exports.createMockStorage = mock_storage_1.default;
var mock_user_1 = require("./mock-user");
exports.mockUser = mock_user_1.default;
var mock_utilities_1 = require("./mock-utilities");
var Strategy = require("./passport-mock-strategy");
var exportModule = Strategy;
exportModule.MockStrategy = Strategy;
exportModule.Strategy = Strategy;
exportModule.mockUser = mockUser;
exportModule.setupSerializeAndDeserialize = mock_utilities_1.setupSerializeAndDeserialize;
exportModule.connectPassport = mock_utilities_1.connectPassport;
exportModule.createMockPassport = createMockPassport;
exportModule.createMockStorage = createMockStorage;
module.exports = exportModule;
exports.connectPassport = mock_utilities_1.connectPassport;
exports.setupSerializeAndDeserialize = mock_utilities_1.setupSerializeAndDeserialize;
exports.default = passport_mock_strategy_1.default;
/**
* Assign to module.exports for commonjs compatibility
*/
module.exports = passport_mock_strategy_1.default;
Object.assign(module.exports, exports);
import { Promise } from 'es6-promise';
import { User } from './mock-user';
declare namespace createMockStorage {
interface MockStorage {
fetchUser: (id: string) => Promise<User>;
saveUser: (user: User) => Promise<User>;
}
export interface MockStorage {
fetchUser: (id: string) => Promise<User>;
saveUser: (user: User) => Promise<User>;
}

@@ -12,3 +10,2 @@ /**

*/
declare function createMockStorage(): createMockStorage.MockStorage;
export = createMockStorage;
export default function createMockStorage(): MockStorage;
"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var es6_promise_1 = require("es6-promise");

@@ -37,2 +41,2 @@ /**

}
module.exports = createMockStorage;
exports.default = createMockStorage;

@@ -1,17 +0,15 @@

declare namespace mockUser {
interface User {
id: string;
displayName?: string;
name: {
familyName: string;
givenName: string;
};
emails: [{
value: string;
type: string;
}];
provider: string;
}
export interface User {
id: string;
displayName?: string;
name: {
familyName: string;
givenName: string;
};
emails: [{
value: string;
type: string;
}];
provider: string;
}
declare const mockUser: mockUser.User;
export = mockUser;
declare const mockUser: User;
export default mockUser;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var mockUser = {

@@ -9,2 +10,2 @@ id: '1234',

};
module.exports = mockUser;
exports.default = mockUser;

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

/// <reference types="passport" />
/// <reference types="express" />
import { Application } from 'express';
import * as passportModule from 'passport';
import passportModule from 'passport';
import { User } from './mock-user';

@@ -6,0 +4,0 @@ export declare type SerializeFn = (user: User, done: (error: any, id: string) => void) => void;

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var mockUser = require("./mock-user");
var mock_user_1 = __importDefault(require("./mock-user"));
var defaultSerialize = function (user, done) {

@@ -8,4 +11,4 @@ return done(null, user.id);

var defaultDeserialize = function (id, done) {
if (id === mockUser.id) {
done(null, mockUser);
if (id === mock_user_1.default.id) {
done(null, mock_user_1.default);
}

@@ -12,0 +15,0 @@ else {

@@ -1,18 +0,14 @@

/// <reference types="express" />
/// <reference types="passport" />
import { Request } from 'express';
import { Strategy } from 'passport';
import { User } from './mock-user';
declare namespace MockStrategy {
interface MockStrategyOptions {
name?: string;
user?: User;
passReqToCallback?: true;
}
type DoneCallback = (error: Error, user?: User, info?: any) => void;
interface VerifyFunction {
(req: Request, user: User, done: DoneCallback): void;
(user: User, done: DoneCallback): void;
}
export interface MockStrategyOptions {
name?: string;
user?: User;
passReqToCallback?: true;
}
export declare type DoneCallback = (error: Error, user?: User, info?: any) => void;
export interface VerifyFunction {
(req: Request, user: User, done: DoneCallback): void;
(user: User, done: DoneCallback): void;
}
/**

@@ -22,3 +18,3 @@ * Mock Passport Strategy for testing purposes.

*/
declare class MockStrategy extends Strategy {
export default class MockStrategy extends Strategy {
private _user;

@@ -57,3 +53,3 @@ private _verify?;

*/
constructor(options?: MockStrategy.MockStrategyOptions, verify?: MockStrategy.VerifyFunction);
constructor(options?: MockStrategyOptions, verify?: VerifyFunction);
/**

@@ -68,2 +64,1 @@ * Authenticate request. Always authenticates successfully by default

}
export = MockStrategy;
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {

@@ -12,3 +15,8 @@ extendStatics(d, b);

})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var passport_1 = require("passport");
var mock_user_1 = __importDefault(require("./mock-user"));
/**

@@ -60,3 +68,3 @@ * Mock Passport Strategy for testing purposes.

_this.name = options.name || 'mock';
_this._user = options.user || require('./mock-user');
_this._user = options.user || mock_user_1.default;
_this._verify = verify;

@@ -102,2 +110,2 @@ _this._passReqToCallback = options.passReqToCallback || false;

}(passport_1.Strategy));
module.exports = MockStrategy;
exports.default = MockStrategy;
{
"name": "passport-mock-strategy",
"version": "1.1.1",
"version": "2.0.0",
"description": "Mock passport strategy for testing Node.js applications.",

@@ -28,24 +28,24 @@ "keywords": [

"dependencies": {
"@types/express": "^4.11.1",
"@types/passport": "^0.4.5",
"es6-promise": "^4.2.4",
"@types/express": "^4.16.1",
"@types/passport": "^1.0.0",
"es6-promise": "^4.2.6",
"passport": "^0.4.0"
},
"devDependencies": {
"cookie-parser": "^1.4.3",
"cookie-parser": "^1.4.4",
"cookie-session": "^2.0.0-beta.3",
"express": "^4.16.3",
"flow-bin": "^0.69.0",
"husky": "^0.14.3",
"jest": "^22.4.3",
"jest-supertest-cookie-fix": "^1.0.0",
"lint-staged": "^7.0.4",
"prettier": "^1.11.1",
"superagent": "^3.8.2",
"supertest": "^3.0.0",
"ts-jest": "^22.4.4",
"tslint": "^5.9.1",
"tslint-config-prettier": "^1.12.0",
"tslint-plugin-prettier": "^1.3.0",
"typescript": "^2.8.3"
"express": "^4.16.4",
"flow-bin": "^0.98.1",
"husky": "^2.2.0",
"jest": "^24.8.0",
"lint-staged": "^8.1.6",
"prettier": "^1.17.0",
"rimraf": "^2.6.3",
"superagent": "^5.0.5",
"supertest": "^4.0.2",
"ts-jest": "^24.0.2",
"tslint": "^5.16.0",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.0.1",
"typescript": "^3.4.5"
},

@@ -56,11 +56,15 @@ "scripts": {

"build:watch": "tsc --watch",
"clean": "rm -rf lib",
"clean": "rimraf lib",
"copy-flow": "cp flow-types/* lib/",
"lint": "tslint -p ./tsconfig.json --fix",
"precommit": "lint-staged",
"prepare": "yarn run build",
"prettier": "prettier --write \"{src,test}/**/*.(js|ts)\"",
"prettier": "prettier --write \"{src,test}/**/*.{js,ts}\"",
"test": "jest",
"test:watch": "jest --watch"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}

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