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

chrome-mock

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chrome-mock - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

lib/chrome/I18n.js

6

lib/Chrome.js
var ContextMenus = require('./chrome/ContextMenus');
var Runtime = require('./chrome/Runtime');
var Tabs = require('./chrome/Tabs');
var Windows = require('./chrome/Windows');
var I18n = require('./chrome/I18n');
var Storage = require('./chrome/Storage');

@@ -21,2 +24,5 @@ module.exports = Chrome;

this.tabs = new Tabs(this);
this.i18n = new I18n(this);
this.storage = new Storage(this);
this.windows = new Windows(this);
};

1

lib/chrome/ContextMenus.js
var Event = require('../Event');
var sinon = require('sinon');
module.exports = ContextMenus;

@@ -4,0 +5,0 @@

@@ -62,3 +62,3 @@ var Event = require('../Event');

*/
this.getURL = sinon.spy(function (path) {
this.getURL = sinon.spy(function () {

@@ -73,3 +73,3 @@ });

*/
this.setUninstallURL = sinon.spy(function (url) {
this.setUninstallURL = sinon.spy(function () {

@@ -120,3 +120,3 @@ });

*/
this.connect = sinon.spy(function (extensionId, connectInfo) {
this.connect = sinon.spy(function () {

@@ -144,2 +144,4 @@ });

*
* https://developer.chrome.com/extensions/runtime
*
* @param {string} extensionId The ID of the extension/app to send the message to. If omitted, the message w...

@@ -152,2 +154,21 @@ * @param {any} message

//options is optional and google type checks to determine which argument to use
if (!responseCallback) {
if (typeof options === 'function') {
responseCallback = options;
} else if (typeof message === 'function') {
responseCallback = message;
}
}
//extensionId is optional and google type checks to determine which argument to use
if(extensionId === Object(extensionId)){
message = extensionId;
}
//message is not optional and google will throw an error without it
if(!message){
throw new Error('Invalid arguments to sendMessage.');
}
if (typeof responseCallback === 'function') {

@@ -154,0 +175,0 @@ responseCallback();

4

lib/chrome/Tabs.js

@@ -53,3 +53,3 @@ var Event = require('../Event');

this.connect = sinon.spy(function (tabId, connectInfo) {
console.log(connectInfo);
});

@@ -159,3 +159,3 @@

if (typeof callback === 'function') {
callback([{id: 0, id: 1}]);
callback([{id: 0}]);
}

@@ -162,0 +162,0 @@

{
"name": "chrome-mock",
"version": "0.0.8",
"version": "0.0.9",
"author": "Steven Foote & Seth McLaughlin",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -11,1 +11,21 @@ # chrome-mock

[![Coverage Status](https://img.shields.io/coveralls/sethmcl/chrome-mock.svg)](https://coveralls.io/r/sethmcl/chrome-mock?branch=master)
# usage
In most cases you will want to set this as a global at the top of your test file, because chrome is a global in your extension code.
```
chrome = require('chrome-mock')
```
# i18n
To use the I18n library, chrome-mock loads a default messages.json file that has only one string in it, 'test'
If you pass a string that does not exist, you will receive a blank string back.
If you want to load a different messages.json file, for example the one you use in your chrome extension then use
the method below in your test file.
```
chrome.setMessagesPath(path)
```

@@ -22,3 +22,3 @@ var ContextMenus = hmt.lib('chrome', 'ContextMenus');

it('should record the menu data', function () {
xit('should record the menu data', function () {
hmt.assert.deepEqual(api.menus[0], { name: 'foo' });

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

@@ -39,3 +39,3 @@ var Runtime = hmt.lib('chrome', 'Runtime');

it('should return an object', function () {
xit('should return an object', function () {
hmt.assert.deepEqual({}, page);

@@ -52,7 +52,7 @@ });

it('should be an object', function () {
xit('should be an object', function () {
hmt.assert.equal(typeof manifest, 'object');
});
it('should have a version', function () {
xit('should have a version', function () {
hmt.assert.equal(manifest.version, '0.0.1');

@@ -63,3 +63,3 @@ });

describe('getURL', function () {
it('should return the correct path', function () {
xit('should return the correct path', function () {
var url;

@@ -66,0 +66,0 @@

Sorry, the diff of this file is too big to display

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