How to use the rosie.Factory function in rosie

To help you get started, we’ve selected a few rosie examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github onap / sdc / openecomp-ui / test-utils / factories / common / CurrentScreenFactory.js View on Github external
Factory.define('InitializedCurrentScreenFactory')
	.option('isCertified', false)
	.option('inMerge', false)
	.option('isCollaborator', true)
	.option('isArchived', false)
	.option('isReadOnlyMode', ['isCertified', 'inMerge', 'isCollaborator', 'isArchived'], (isCertified, inMerge, isCollaborator, isArchived) =>
		isCertified || inMerge || !isCollaborator
	)
	.attr('itemPermission', ['isCertified', 'inMerge', 'isCollaborator'], (isCertified, inMerge, isCollaborator) =>
		InitializedItemPermissionFactory.build({isCollaborator, isCertified, inMerge})
	)
	.attr('props', ['isReadOnlyMode'], (isReadOnlyMode) => {
		return {isReadOnlyMode};
	});
export const InitializedCurrentScreenFactory = new Factory().extend('InitializedCurrentScreenFactory');


Factory.define('CurrentScreenFactory')
	.extend('InitializedCurrentScreenFactory')
	.option('isDirty', false)
	.option('isOutOfSync', false)
	.option('isUpToDate', true)
	.option('version', ['isCertified'], (isCertified) => VersionFactory.build({isCertified}))
	.attr('itemPermission', [
		'isCertified', 'inMerge', 'isCollaborator', 'isDirty', 'isOutOfSync', 'isUpToDate', 'isArchived'
	], (isCertified, inMerge, isCollaborator, isDirty, isOutOfSync, isUpToDate, isArchived) =>
		ItemPermissionFactory.build({isCollaborator, isCertified, inMerge, isDirty, isOutOfSync, isUpToDate, isArchived})
	)
	.attr('props', ['isReadOnlyMode', 'version'], (isReadOnlyMode, version) => {
		return {isReadOnlyMode, version};
	});
github onap / sdc / openecomp-ui / test-utils / factories / softwareProduct / SoftwareProductValidationResultsFactory.js View on Github external
*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { Factory } from 'rosie';

export const VSPTestResultsFailureFactory = new Factory().attrs({
    vspTestResults: [
        {
            scenario: 'certification',
            description: 'Other Certifications',
            testCaseName: 'certification.certificationtests.certquery',
            testSuiteName: 'certificationtests',
            executionId: 'ebaa5f21-ed68-4098-97a9-775ac8800f09-1550575025614',
            parameters: {
                vspId: 'uuidval',
                vspVersion: 'ver',
                other: 'values'
            },
            results: {
                UnknownObject: {
                    someKeyanotherobject2: 'someValue',
                    someKey1: 'someValue',
github onap / sdc / openecomp-ui / test-utils / factories / softwareProduct / SoftwareProductComponentsComputeFactory.js View on Github external
export const ComputeFlavorBaseData = new Factory()
	.attrs({
		name: () => randomstring.generate(),
		description: () => randomstring.generate(),
		id: randomstring.generate()
	});

export const ComponentComputeFactory = new Factory()
	.attrs({
		computesList: [],
		computeEditor: {}
	});


export const VSPComponentsComputeDataMapFactory = new Factory()
	.attrs({
		'vmSizing/numOfCPUs' : 3,
		'vmSizing/fileSystemSizeGB': 888,
		'numOfVMs/minimum':2
	});
github onap / sdc / openecomp-ui / test-utils / factories / licenseModel / LicenseKeyGroupFactories.js View on Github external
export const LicenseKeyGroupListItemFactory = new Factory()
    .extend('LicenseKeyGroupBaseFactory')
    .attrs({
        id: () => Math.floor(Math.random() * (1000 - 1) + 1),
        versionUUID: () => Math.floor(Math.random() * (1000 - 1) + 1),
        itemType: overviewEditorHeaders.LICENSE_KEY_GROUP
    });

export const LicenseKeyGroupStoreFactory = new Factory()
    .extend('LicenseKeyGroupBaseFactory')
    .attrs({
        id: () => Math.floor(Math.random() * (1000 - 1) + 1),
        referencingFeatureGroups: []
    });

export const LicenseKeyGroupDataListFactory = new Factory()
    .extend('LicenseKeyGroupBaseFactory')
    .attrs({
        id: () => Math.floor(Math.random() * (1000 - 1) + 1),
        referencingFeatureGroups: [],
        itemType: overviewEditorHeaders.LICENSE_KEY_GROUP
    });

export const LicenseKeyGroupPostFactory = new Factory().extend(
    'LicenseKeyGroupBaseFactory'
);
github onap / sdc / openecomp-ui / test-utils / factories / softwareProduct / SoftwareProductEditorFactories.js View on Github external
Factory.define('LicensingDataMixin')
	.attrs({
		licensingData: {
			licenseAgreement: () => randomstring.generate(33),
			featureGroups: [
				() => randomstring.generate(33)
			]
		}
	});

export const VSPEditorFactory = new Factory()
	.extend('VSPBaseFactory')
	.extend(IdMixin);

export const VSPEditorPostFactory = new Factory()
	.extend('VSPBaseFactory');

export const VSPEditorFactoryWithLicensingData = new Factory()
	.extend('VSPBaseFactory')
	.extend('LicensingDataMixin')
	.extend(IdMixin);

export const VSPEditorPostFactoryWithLicensingData = new Factory()
	.extend('VSPBaseFactory')
	.extend('LicensingDataMixin');
github onap / sdc / openecomp-ui / test-utils / factories / licenseModel / FeatureGroupFactories.js View on Github external
import { Factory } from 'rosie';
import { overviewEditorHeaders } from 'sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewConstants.js';
import IdMixin from 'test-utils/factories/mixins/IdMixin.js';

Factory.define('FeatureGroupBaseFactory').attrs({
    name: 'featureGroup',
    description: 'description'
});

Factory.define('FeatureGroupExtendedBaseFactory')
    .extend('FeatureGroupBaseFactory')
    .attrs({
        partNumber: '1212'
    });

export const FeatureGroupListItemFactory = new Factory()
    .extend('FeatureGroupBaseFactory')
    .extend(IdMixin)
    .attrs({
        children: [],
        isCollapsed: true,
        itemType: overviewEditorHeaders.FEATURE_GROUP
    });

export const FeatureGroupDispatchFactory = new Factory()
    .extend('FeatureGroupExtendedBaseFactory')
    .attrs({
        licenseKeyGroupsIds: [],
        entitlementPoolsIds: []
    });

export const FeatureGroupStoreFactory = new Factory()
github onap / sdc / openecomp-ui / test-utils / factories / softwareProduct / SoftwareProductValidationFactory.js View on Github external
endpoint: 'ovp'
        },
        'certification.certificationtests.certquery': {
            parameters: {
                vspId: '',
                vspVersion: ''
            },
            scenario: 'certification',
            testCaseName: 'certification.certificationtests.certquery',
            testSuiteName: 'certificationtests',
            endpoint: 'repository'
        }
    }
});

export const VSPTestsMapFactory = new Factory().attrs({
    vspTestsMap: {
        'compliance.compliancetests.sriov': {
            title: ' SR-IOV Test',
            parameters: [
                {
                    name: 'vspId',
                    description: 'VSP ID',
                    type: 'text',
                    isOptional: false,
                    metadata: {
                        disabled: false,
                        maxLength: '36',
                        minLength: '1'
                    }
                },
                {
github onap / sdc / openecomp-ui / test-utils / factories / softwareProduct / SoftwareProductComponentsMonitoringFactories.js View on Github external
export const trap = type2Name[fileTypes.SNMP_TRAP];
export const poll = type2Name[fileTypes.SNMP_POLL];
export const ves = type2Name[fileTypes.VES_EVENT];

export const VSPComponentsMonitoringRestFactory = new Factory()
	.option('createTrap', false)
	.option('createPoll', false)
	.option('createVes', false)

	.attr(trap, ['createTrap'], (createTrap) => createTrap ? randomstring.generate() : undefined)
	.attr(poll, ['createPoll'], (createPoll) => createPoll ? randomstring.generate() : undefined)
	.attr(ves, ['createVes'], (createVes) => createVes ? randomstring.generate() : undefined);


export const VSPComponentsMonitoringViewFactory = new Factory()
	.extend(VSPComponentsMonitoringRestFactory);
github onap / sdc / openecomp-ui / test-utils / factories / licenseModel / EntitlementPoolFactories.js View on Github external
export const EntitlementPoolStoreFactory = new Factory()
    .extend('EntitlementPoolExtendedBaseFactory')
    .attrs({
        id: () => Math.floor(Math.random() * (1000 - 1) + 1),
        referencingFeatureGroups: []
    });

export const EntitlementPoolDataListFactory = new Factory()
    .extend('EntitlementPoolExtendedBaseFactory')
    .attrs({
        id: () => Math.floor(Math.random() * (1000 - 1) + 1),
        referencingFeatureGroups: [],
        itemType: overviewEditorHeaders.ENTITLEMENT_POOL
    });

export const EntitlementPoolPostFactory = new Factory().extend(
    'EntitlementPoolExtendedBaseFactory'
);
github onap / sdc / openecomp-ui / test-utils / factories / softwareProduct / SoftwareProductFactory.js View on Github external
*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
import { Factory } from 'rosie';

export const SoftwareProductFactory = new Factory().attrs({
    softwareProductAttachments: {},
    softwareProductCreation: {},
    softwareProductEditor: {},
    softwareProductValidation: {},
    softwareProductProcesses: {
        processesList: [],
        processesEditor: {},
        processToDelete: false
    },
    softwareProductNetworks: {
        networksList: []
    },
    softwareProductComponents: {
        componentsList: [],
        componentEditor: {},
        componentProcesses: {

rosie

factory for building JavaScript objects, mostly useful for setting up test data. Inspired by factory_girl

MIT
Latest version published 6 months ago

Package Health Score

70 / 100
Full package analysis