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

@shopify/slate-config

Package Overview
Dependencies
Maintainers
7
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/slate-config - npm Package Compare versions

Comparing version 1.0.0-alpha.16 to 1.0.0-alpha.17

5

__tests__/fixtures/schema.js

@@ -8,3 +8,8 @@ module.exports = {

},
{
id: 'test-array',
default: ['item1', 'item2'],
type: 'array',
},
],
};

6

__tests__/index.test.js

@@ -0,3 +1,3 @@

const fs = require('fs');
const slateConfig = require('../index');
const fs = require('fs');
const schema = require('./fixtures/schema');

@@ -13,3 +13,3 @@ const slaterc = require('./fixtures/slaterc.json');

schema.items[0].id,
schema.items[0].default
schema.items[0].default,
);

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

schema.items[0].id,
'override-value'
'override-value',
);

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

@@ -14,2 +14,11 @@ const validate = require('../validate');

describe('test: isValidType', () => {
test('validates item of type array when read from json', () => {
const json = '{"test-array": ["item1", "item2", "item3"]}';
const slatercWithArray = JSON.parse(json);
const results = validate(schema, slatercWithArray);
expect(results).toHaveProperty('isValid');
expect(results.isValid).toEqual(true);
});
test('returns error if invalid type is provided', () => {

@@ -16,0 +25,0 @@ const invalidSlateRc = Object.assign({}, slaterc, {

{
"name": "@shopify/slate-config",
"version": "1.0.0-alpha.16",
"version": "1.0.0-alpha.17",
"description": "Generate Slate config files",

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

@@ -19,2 +19,10 @@ function validate(schema, slaterc) {

function extractType(item, value) {
if (item.type === `array` && Array.isArray(value)) {
return item.type;
}
return typeof value;
}
function isValidType(schema, slaterc) {

@@ -27,3 +35,3 @@ const errors = [];

const value = slaterc[key];
const type = typeof value;
const type = extractType(item, value);

@@ -35,3 +43,3 @@ if (type !== 'undefined') {

item.type
}' but received type '${type}'`
}' but received type '${type}'`,
);

@@ -38,0 +46,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