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

imdbtr

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imdbtr - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

2

package.json
{
"name": "imdbtr",
"version": "0.2.1",
"version": "0.2.2",
"description": "IMDB on terminal",

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

@@ -9,2 +9,17 @@ 'use strict';

const normalizeName = name => {
const nameList = name.split(' ', 2);
let normalizedList = [];
if (nameList.length > 1) {
normalizedList = nameList.map(currName => {
return encodeURI(currName);
});
normalizedList = normalizedList.join('+');
}
return normalizedList.toString();
};
const api = name => {

@@ -15,5 +30,7 @@ if (!name) {

const movie = got(`${provider}t=${name}`, {headers})
const normalizedName = normalizeName(name);
const movie = got(`${provider}t=${normalizedName}`, {headers, json: true})
.then(response => {
const result = JSON.parse(response.body);
const result = response.body;
return result.Response === 'False' ? false : result;

@@ -20,0 +37,0 @@ })

@@ -6,12 +6,17 @@ 'use strict';

test('should return the name of movie when it\'s valid title', t => {
const response = api('The Godfather');
test(`should return the name of movie when it's valid title`, async t => {
const result = await api('The Godfather');
return response.then(result => {
t.is(result.Title, 'The Godfather');
t.is(result.Year, '1972');
});
t.is(result.Title, 'The Godfather');
t.is(result.Year, '1972');
});
test('should return error when it\'s a empty string', t => {
test(`should return the name of movie when it's valid title with accented`, async t => {
const result = await api('Garoto Cósmico');
t.is(result.Title, 'Garoto Cósmico');
t.is(result.Year, '2007');
});
test(`should return error when it's a empty string`, t => {
const response = api('');

@@ -22,3 +27,3 @@

test('should return error when it\'s a invalid entry', t => {
test(`should return error when it's a invalid entry`, t => {
const response = api();

@@ -25,0 +30,0 @@

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