index.js 856 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import { shallowMount } from '@vue/test-utils'
  2. import VmPublicCreateBill from '../index.vue'
  3. import i18n from '@/locales'
  4. describe('VmPublicCreateBill', () => {
  5. it('check buyDurationOptions in aliyun, first item is 1W', () => {
  6. const decorators = {
  7. billType: [
  8. 'billType',
  9. {
  10. initialValue: 'quantity',
  11. },
  12. ],
  13. duration: [
  14. 'duration',
  15. {
  16. initialValue: '1M',
  17. },
  18. ],
  19. }
  20. const providerList = ['aliyun']
  21. const wrapper = shallowMount(VmPublicCreateBill, {
  22. propsData: {
  23. decorators,
  24. providerList,
  25. },
  26. })
  27. wrapper.vm.$nextTick(() => {
  28. expect(wrapper.vm.buyDurationOptions[0]).toEqual({
  29. label: i18n.t('compute.text_24'),
  30. key: '1W',
  31. unit: 'W',
  32. includes: ['aliyun'],
  33. })
  34. })
  35. })
  36. })