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

@bufferapp/analyze-profile-selector

Package Overview
Dependencies
Maintainers
34
Versions
210
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bufferapp/analyze-profile-selector - npm Package Compare versions

Comparing version 1.77.0 to 1.77.1

3

mocks/profiles.js

@@ -71,1 +71,4 @@ const avatarUrl = 'https://buffer-uploads.s3.amazonaws.com/503a5c8ffc99f72a7f00002e/f49c2ff693f1c307af5e1b3d84e581ca.png';

}
export const legacyResult = [...twitterProfiles, ...facebookProfiles, ...instagramProfiles];

2

package.json
{
"name": "@bufferapp/analyze-profile-selector",
"version": "1.77.0",
"version": "1.77.1",
"description": "Profile selector dropdown",

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

@@ -64,3 +64,3 @@ import { actionTypes as fetchActions } from '@bufferapp/async-data-fetch';

function ensureTimezone(profiles) {
function ensureTimezone(profiles = []) {
return profiles.map(profile => {

@@ -78,4 +78,9 @@ if (profile.timezone) {

export function getSocialProfilesFromResult(result) {
return result?.social || result;
}
export const getAllProfilesFromResult = (result) => {
return result.social?.concat(result.nonSocial) || []
const profiles = getSocialProfilesFromResult(result)?.concat(result.nonSocial) || []
return profiles.filter(p => p !== undefined)
}

@@ -89,3 +94,3 @@

profiles: ensureTimezone(getAllProfilesFromResult(action.result)),
socialProfiles: ensureTimezone(action.result.social),
socialProfiles: ensureTimezone(getSocialProfilesFromResult(action.result.social)),
nonSocialProfiles: ensureTimezone(action.result.nonSocial),

@@ -92,0 +97,0 @@ organizationId: getAllProfilesFromResult(action.result)[0] ?

import { actionTypes as fetchActions } from '@bufferapp/async-data-fetch';
import moment from 'moment-timezone';
import reducer, { actions, actionTypes, getProfilesWithFreshData } from './reducer';
import mockProfiles, { withInvalidProfile as mockInvalidProfiles } from './mocks/profiles';
import reducer, {
actionTypes,
actions,
getAllProfilesFromResult,
getProfilesWithFreshData,
getSocialProfilesFromResult,
} from './reducer';
import mockProfiles, { withInvalidProfile as mockInvalidProfiles, legacyResult } from './mocks/profiles';
const navigationStart = moment().subtract(5, 'minutes').unix() * 1000;

@@ -251,1 +256,25 @@ const beforeNavigationStart = moment().subtract(10, 'minutes').unix() * 1000;

});
describe('getProfiles', () => {
it('return social profiles', () => {
const expectedProfiles = mockProfiles.social;
expect(getSocialProfilesFromResult(mockProfiles))
.toEqual(expectedProfiles);
});
it('return legacy profiles response result', () => {
expect(getSocialProfilesFromResult(legacyResult))
.toEqual(legacyResult);
});
it('return aggregated profiles', () => {
const expectedProfiles = mockProfiles.social.concat(mockProfiles.nonSocial);
expect(getAllProfilesFromResult(mockProfiles))
.toEqual(expectedProfiles);
});
it('return legacy profiles results', () => {
expect(getAllProfilesFromResult(legacyResult))
.toEqual(legacyResult);
});
});
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