svishnev | ea5e43c | 2018-04-15 09:06:57 +0300 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2016-2018 European Support Limited |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | import { Factory } from 'rosie'; |
| 18 | import randomstring from 'randomstring'; |
| 19 | import IdMixin from 'test-utils/factories/mixins/IdMixin.js'; |
| 20 | |
| 21 | export const itemFactory = new Factory() |
| 22 | .extend(IdMixin) |
| 23 | .option('isArchived', false) |
| 24 | .attrs({ |
| 25 | description: () => randomstring.generate(), |
| 26 | name: () => randomstring.generate(), |
| 27 | owner: () => randomstring.generate() |
| 28 | }) |
| 29 | .attr('status', ['isArchived'], isArchived => { |
| 30 | return isArchived ? 'ARCHIVE' : 'ACTIVE'; |
| 31 | }); |
| 32 | |
| 33 | export const vspFactory = new Factory().extend(itemFactory).attrs({ |
| 34 | type: 'vsp', |
| 35 | properties: { |
| 36 | onboardingMethod: 'NetworkPackage', |
| 37 | vendorId: randomstring.generate(33), |
| 38 | vendorName: randomstring.generate() |
| 39 | } |
| 40 | }); |
| 41 | |
| 42 | export const vlmFactory = new Factory().extend(itemFactory).attrs({ |
| 43 | type: 'vlm', |
| 44 | properties: {} |
| 45 | }); |