Socket
Socket
Sign inDemoInstall

jetpack-id

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.2 to 0.0.3

5

index.js

@@ -11,5 +11,4 @@ /**

return manifest.id;
// Otherwise, append '@jetpack' to the id. `cfx` creates an
// invalid `id`, so this needs to be supported
return manifest.id + "@jetpack";
// Otherwise, this ID is invalid so return `null`
return null;
}

@@ -16,0 +15,0 @@

2

package.json
{
"name": "jetpack-id",
"version": "0.0.2",
"version": "0.0.3",
"description": "Creates an ID from a Firefox Jetpack manifest",

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

@@ -5,28 +5,37 @@ var getID = require("../");

describe("jetpack-id", function () {
it("Returns GUID when `id` GUID", function () {
var guid = "{8490ae4f-93bc-13af-80b3-39adf9e7b243}";
expect(getID({ id: guid })).to.be.equal(guid);
describe("valid", function () {
it("Returns GUID when `id` GUID", function () {
var guid = "{8490ae4f-93bc-13af-80b3-39adf9e7b243}";
expect(getID({ id: guid })).to.be.equal(guid);
});
it("Returns domain id when `id` domain id", function () {
var id = "my-addon@jetpack";
expect(getID({ id: id })).to.be.equal(id);
});
it("allows underscores in name", function () {
var name = "my_addon";
expect(getID({ name: name })).to.be.equal("@" + name);
});
it("allows underscores in id", function () {
var id = "my_addon@jetpack";
expect(getID({ id: id })).to.be.equal(id);
});
it("Returns valid name when `name` exists", function () {
var id = "my-addon";
expect(getID({ name: id })).to.be.equal("@" + id);
});
});
it("Returns domain id when `id` domain id", function () {
var id = "my-addon@jetpack";
expect(getID({ id: id })).to.be.equal(id);
describe("invalid", function () {
it("Returns null when `id` and `name` do not exist", function () {
expect(getID({})).to.be.equal(null);
});
it("Returns null when no object passed in", function () {
expect(getID()).to.be.equal(null);
});
it("Returns null when `id` exists but not GUID/domain", function () {
var id = "my-addon";
expect(getID({ id: id })).to.be.equal(null);
});
});
it("Returns domain id when `id` exists but not GUID/domain", function () {
var id = "my-addon";
expect(getID({ id: id })).to.be.equal(id + "@jetpack");
});
it("allows underscores in ID", function () {
var id = "my_addon";
expect(getID({ id: id })).to.be.equal(id + "@jetpack");
});
it("Returns valid name when `name` exists", function () {
var id = "my-addon";
expect(getID({ name: id })).to.be.equal("@" + id);
});
it("Returns null when `id` and `name` do not exist", function () {
expect(getID({})).to.be.equal(null);
});
it("Returns null when no object passed in", function () {
expect(getID()).to.be.equal(null);
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc