Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
{
idAttribute: (value, parent, sgName) => sgName,
processStrategy: (value, parent, sgName) => {
// We need to add a computed `id` attribute to the sshKey,
// so we know the context of the key itself
// e.g sitegroup = 'deploytest1' & sshKey = 'pat' => 'deploytest1/pat'
// To maintain consistency with the yaml file content, we need to omit
// the id attribute in the ssh key normalization process (see sshKey schema)
const sshKeys = addSshKeyId('sitegroup', sgName, value.ssh_keys);
return Object.assign({}, value, { ssh_keys: sshKeys });
},
}
);
const siteGroupObjSchema = new schema.Values(siteGroupObj);
// const clientSchema = { ssh_keys: sshKey };
// const normalizeClient = (data: Object): Object => ({});
const normalizeSiteGroupObj = (data: Object): Object =>
normalize(data, siteGroupObjSchema);
// const denormalizeSiteGroup = (entities: Object, data: Object): Object =>
// denormalize(data, siteGroupFileSchema, entities);
module.exports = {
// denormalizeSiteGroup,
normalizeSiteGroupObj,
};
describe('parsing an array of entities and collections', () => {
const articleSchema = new Schema.Entity('articles');
const userSchema = new Schema.Entity('users');
const collectionSchema = new Schema.Entity('collections');
articleSchema.define({
collections: new Schema.Values(collectionSchema),
});
collectionSchema.define({
curator: userSchema,
});
const article1 = {
id: 1,
title: 'Some Article',
collections: {
1: {
id: 1,
name: 'Dan',
},
2: {
id: 2,
describe('parsing a map of entities and collections', () => {
const articleSchema = new schema.Entity('articles');
const userSchema = new schema.Entity('users');
const collectionSchema = new schema.Entity('collections');
articleSchema.define({
collections: new schema.Values(collectionSchema),
});
collectionSchema.define({
curator: userSchema,
});
const article1 = {
id: 1,
title: 'Some Article',
collections: {
1: {
id: 1,
name: 'Dan',
},
2: {
id: 2,