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

jest-useragent-mock

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

jest-useragent-mock - npm Package Compare versions

Comparing version 0.0.3 to 0.1.0

7

dist/index.js

@@ -6,10 +6,11 @@ 'use strict';

var origin = global.navigator.userAgent;
var cleared = Symbol('clear');
var fakeUserAgent = null;
Object.defineProperty(global.navigator, 'userAgent', {
get: function _get() {
return fakeUserAgent || origin;
get: function get() {
return fakeUserAgent === cleared ? origin : fakeUserAgent || '';
}
});
var clear = function clear() {
fakeUserAgent = '';
fakeUserAgent = cleared;
};

@@ -16,0 +17,0 @@ var mockUserAgent = function mockUserAgent(agent) {

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var origin=global.navigator.userAgent,fakeUserAgent=null;Object.defineProperty(global.navigator,"userAgent",{get:function(){return fakeUserAgent||origin}});var clear=function(){fakeUserAgent=""},mockUserAgent=function(e){fakeUserAgent=e};exports.clear=clear,exports.mockUserAgent=mockUserAgent;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var origin=global.navigator.userAgent,cleared=Symbol("clear"),fakeUserAgent=null;Object.defineProperty(global.navigator,"userAgent",{get:function(){return fakeUserAgent===cleared?origin:fakeUserAgent||""}});var clear=function(){fakeUserAgent=cleared},mockUserAgent=function(e){fakeUserAgent=e};exports.clear=clear,exports.mockUserAgent=mockUserAgent;
{
"name": "jest-useragent-mock",
"version": "0.0.3",
"version": "0.1.0",
"description": "Mock `navigator.userAgent` when run unit test cases with jest.",

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

@@ -5,2 +5,4 @@ # jest-useragent-mock

[![Build Status](https://travis-ci.org/ariesjia/jest-useragent-mock.svg?branch=master)](https://travis-ci.org/ariesjia/jest-useragent-mock)
[![license](https://badgen.net/badge/license/MIT/blue)](https://github.com/ariesjia/jest-useragent-mock/blob/master/LICENSE)
[![coverage](https://badgen.net/codecov/c/github/ariesjia/jest-useragent-mock)](https://codecov.io/gh/ariesjia/jest-useragent-mock)

@@ -7,0 +9,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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