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

insomnia-cookies

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

insomnia-cookies - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

46

__tests__/index.test.js

@@ -1,11 +0,13 @@

const {CookieJar} = require('tough-cookie');
const {cookieToString, jarFromCookies, cookiesFromJar} = require('..');
const { CookieJar } = require('tough-cookie');
const { cookieToString, jarFromCookies, cookiesFromJar } = require('..');
describe('jarFromCookies()', () => {
it('returns valid cookies', done => {
const jar = jarFromCookies([{
key: 'foo',
value: 'bar',
domain: 'google.com'
}]);
const jar = jarFromCookies([
{
key: 'foo',
value: 'bar',
domain: 'google.com'
}
]);

@@ -32,13 +34,16 @@ jar.store.getAllCookies((err, cookies) => {

const d = new Date();
const initialCookies = [{
key: 'bar',
value: 'baz',
domain: 'insomnia.rest',
expires: d
}, {
// This one will fail to parse, and be skipped
bad: 'cookie'
}];
const initialCookies = [
{
key: 'bar',
value: 'baz',
domain: 'insomnia.rest',
expires: d
},
{
// This one will fail to parse, and be skipped
bad: 'cookie'
}
];
const jar = CookieJar.fromJSON({cookies: initialCookies});
const jar = CookieJar.fromJSON({ cookies: initialCookies });

@@ -50,3 +55,5 @@ const cookies = await cookiesFromJar(jar);

expect(cookies[0].value).toBe('baz');
expect(cookies[0].creation).toMatch(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/);
expect(cookies[0].creation).toMatch(
/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/
);
expect(cookies[0].expires).toEqual(d.toISOString());

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

it('handles bad jar', async () => {
const jar = CookieJar.fromJSON({cookies: []});
const jar = CookieJar.fromJSON({ cookies: [] });

@@ -68,2 +75,1 @@ // MemoryStore never actually throws errors, so lets mock the

});

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

const {CookieJar, Cookie} = require('tough-cookie');
const { CookieJar, Cookie } = require('tough-cookie');

@@ -8,3 +8,3 @@ /**

*/
module.exports.cookiesFromJar = function (jar) {
module.exports.cookiesFromJar = function(jar) {
return new Promise(resolve => {

@@ -28,3 +28,3 @@ jar.store.getAllCookies((err, cookies) => {

*/
module.exports.jarFromCookies = function (cookies) {
module.exports.jarFromCookies = function(cookies) {
let jar;

@@ -35,3 +35,3 @@

// just to be sure
const copy = JSON.stringify({cookies});
const copy = JSON.stringify({ cookies });
jar = CookieJar.fromJSON(copy);

@@ -49,3 +49,3 @@ } catch (e) {

module.exports.cookieToString = function (cookie) {
module.exports.cookieToString = function(cookie) {
// Cookie can either be a plain JS object or Cookie instance

@@ -66,2 +66,1 @@ if (!(cookie instanceof Cookie)) {

};
{
"name": "insomnia-cookies",
"version": "0.0.4",
"version": "0.0.5",
"author": "Gregory Schier <gschier1990@gmail.com>",

@@ -5,0 +5,0 @@ "description": "Cookie utilities",

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