From 93b2fbc34281030deea02f221955212b7bdf163e Mon Sep 17 00:00:00 2001 From: Jeff Sagal Date: Sun, 17 Jul 2022 12:53:57 -0700 Subject: [PATCH] use aliases in tests --- tests/unit/Ajax.spec.js | 2 +- tests/unit/Autoscroll.spec.js | 2 +- tests/unit/Dropdown.spec.js | 4 ++-- tests/unit/Filtering.spec.js | 2 +- tests/unit/Keydown.spec.js | 2 +- tests/unit/Labels.spec.js | 2 +- tests/unit/Layout.spec.js | 2 +- tests/unit/OptionComparator.spec.js | 2 +- tests/unit/OptionKey.spec.js | 2 +- tests/unit/ReactiveOptions.spec.js | 14 +++++++------- tests/unit/Reduce.spec.js | 4 ++-- tests/unit/Selecting.spec.js | 4 ++-- tests/unit/Tagging.spec.js | 8 ++++---- tests/unit/TypeAhead.spec.js | 2 +- tests/unit/utility/sortAndStringify.spec.js | 2 +- tests/unit/utility/uniqueId.spec.js | 2 +- 16 files changed, 28 insertions(+), 28 deletions(-) diff --git a/tests/unit/Ajax.spec.js b/tests/unit/Ajax.spec.js index 4ffdbf9..82c6eee 100755 --- a/tests/unit/Ajax.spec.js +++ b/tests/unit/Ajax.spec.js @@ -1,7 +1,7 @@ import { it, describe, expect } from 'vitest' import { selectWithProps } from '../helpers.js' import { shallowMount } from '@vue/test-utils' -import vSelect from '../../src/components/Select.vue' +import vSelect from '@/components/Select.vue' describe('Asynchronous Loading', () => { it('can toggle the loading class', () => { diff --git a/tests/unit/Autoscroll.spec.js b/tests/unit/Autoscroll.spec.js index e0d5790..9c285a0 100644 --- a/tests/unit/Autoscroll.spec.js +++ b/tests/unit/Autoscroll.spec.js @@ -1,5 +1,5 @@ import { it, describe, expect, vi, afterEach } from 'vitest' -import pointerScroll from '../../src/mixins/pointerScroll.js' +import pointerScroll from '@/mixins/pointerScroll.js' import { mountDefault } from '../helpers.js' describe('Automatic Scrolling', () => { diff --git a/tests/unit/Dropdown.spec.js b/tests/unit/Dropdown.spec.js index 0cb1a98..0ff74f9 100755 --- a/tests/unit/Dropdown.spec.js +++ b/tests/unit/Dropdown.spec.js @@ -1,7 +1,7 @@ import { it, describe, expect, vi, afterEach } from 'vitest' import { selectWithProps } from '../helpers.js' -import OpenIndicator from '../../src/components/OpenIndicator.vue' -import VueSelect from '../../src/components/Select.vue' +import OpenIndicator from '@/components/OpenIndicator.vue' +import VueSelect from '@/components/Select.vue' const preventDefault = vi.fn() diff --git a/tests/unit/Filtering.spec.js b/tests/unit/Filtering.spec.js index 5b55b1a..d7d425f 100755 --- a/tests/unit/Filtering.spec.js +++ b/tests/unit/Filtering.spec.js @@ -1,6 +1,6 @@ import { it, describe, expect } from 'vitest' import { shallowMount } from '@vue/test-utils' -import VueSelect from '../../src/components/Select.vue' +import VueSelect from '@/components/Select.vue' describe('Filtering Options', () => { it("should update the search value when the input element receives the 'input' event", () => { diff --git a/tests/unit/Keydown.spec.js b/tests/unit/Keydown.spec.js index 3773ee6..e839607 100644 --- a/tests/unit/Keydown.spec.js +++ b/tests/unit/Keydown.spec.js @@ -1,5 +1,5 @@ import { it, describe, expect, vi, afterEach } from 'vitest' -import typeAheadPointer from '../../src/mixins/typeAheadPointer.js' +import typeAheadPointer from '@/mixins/typeAheadPointer.js' import { mountDefault } from '../helpers.js' describe('Custom Keydown Handlers', () => { diff --git a/tests/unit/Labels.spec.js b/tests/unit/Labels.spec.js index 0d0de1b..5f713f6 100755 --- a/tests/unit/Labels.spec.js +++ b/tests/unit/Labels.spec.js @@ -1,6 +1,6 @@ import { it, describe, expect, vi } from 'vitest' import { shallowMount } from '@vue/test-utils' -import VueSelect from '../../src/components/Select.vue' +import VueSelect from '@/components/Select.vue' import { selectWithProps } from '../helpers.js' describe('Labels', () => { diff --git a/tests/unit/Layout.spec.js b/tests/unit/Layout.spec.js index c90d9b7..4b36eb0 100755 --- a/tests/unit/Layout.spec.js +++ b/tests/unit/Layout.spec.js @@ -1,6 +1,6 @@ import { it, describe, expect } from 'vitest' import { shallowMount } from '@vue/test-utils' -import VueSelect from '../../src/components/Select.vue' +import VueSelect from '@/components/Select.vue' describe('Single value options', () => { it('should reset the search input on focus lost', () => { diff --git a/tests/unit/OptionComparator.spec.js b/tests/unit/OptionComparator.spec.js index a1d06ee..8894a24 100644 --- a/tests/unit/OptionComparator.spec.js +++ b/tests/unit/OptionComparator.spec.js @@ -1,5 +1,5 @@ import { it, describe, expect } from 'vitest' -import Select from '../../src/components/Select.vue' +import Select from '@/components/Select.vue' describe('Comparing Options', () => { const comparator = Select.methods.optionComparator.bind({ diff --git a/tests/unit/OptionKey.spec.js b/tests/unit/OptionKey.spec.js index ea9ce9f..b3f8f7e 100644 --- a/tests/unit/OptionKey.spec.js +++ b/tests/unit/OptionKey.spec.js @@ -1,5 +1,5 @@ import { it, describe, expect } from 'vitest' -import Select from '../../src/components/Select.vue' +import Select from '@/components/Select.vue' describe('Serializing Option Keys', () => { const getOptionKey = Select.props.getOptionKey.default diff --git a/tests/unit/ReactiveOptions.spec.js b/tests/unit/ReactiveOptions.spec.js index 7425f8f..7d74d1f 100755 --- a/tests/unit/ReactiveOptions.spec.js +++ b/tests/unit/ReactiveOptions.spec.js @@ -1,6 +1,6 @@ import { it, describe, expect, vi, afterEach } from 'vitest' import { shallowMount } from '@vue/test-utils' -import VueSelect from '../../src/components/Select.vue' +import VueSelect from '@/components/Select.vue' import { mountDefault } from '../helpers.js' describe('Reset on options change', () => { @@ -46,7 +46,7 @@ describe('Reset on options change', () => { }) it('should receive the new options, old options, and current value', async () => { - let resetOnOptionsChange = vi.fn((option) => option) + const resetOnOptionsChange = vi.fn((option) => option) const Select = mountDefault({ resetOnOptionsChange, options: ['bear'], @@ -64,7 +64,7 @@ describe('Reset on options change', () => { }) it('should allow resetOnOptionsChange to be a function that returns true', async () => { - let resetOnOptionsChange = () => true + const resetOnOptionsChange = () => true spy = vi.spyOn(VueSelect.methods, 'clearSelection') const Select = shallowMount(VueSelect, { props: { resetOnOptionsChange, options: ['one'], modelValue: 'one' }, @@ -76,7 +76,7 @@ describe('Reset on options change', () => { }) it('should allow resetOnOptionsChange to be a function that returns false', () => { - let resetOnOptionsChange = () => false + const resetOnOptionsChange = () => false spy = vi.spyOn(VueSelect.methods, 'clearSelection') const Select = shallowMount(VueSelect, { props: { resetOnOptionsChange, options: ['one'], modelValue: 'one' }, @@ -87,7 +87,7 @@ describe('Reset on options change', () => { }) it('should reset the options if the selectedValue does not exist in the new options', async () => { - let resetOnOptionsChange = (options, old, val) => + const resetOnOptionsChange = (options, old, val) => val.some((val) => options.includes(val)) spy = vi.spyOn(VueSelect.methods, 'clearSelection') const Select = shallowMount(VueSelect, { @@ -136,7 +136,7 @@ describe('Reset on options change', () => { it('clearSearchOnBlur returns false when multiple is true', async () => { const Select = mountDefault({}) - let clearSearchOnBlur = vi.spyOn(Select.vm.$.props, 'clearSearchOnBlur') + const clearSearchOnBlur = vi.spyOn(Select.vm.$.props, 'clearSearchOnBlur') await Select.get('input').trigger('click') Select.vm.search = 'one' await Select.get('input').trigger('blur') @@ -150,7 +150,7 @@ describe('Reset on options change', () => { }) it('clearSearchOnBlur accepts a function', async () => { - let clearSearchOnBlur = vi.fn(() => false) + const clearSearchOnBlur = vi.fn(() => false) const Select = mountDefault({ clearSearchOnBlur }) await Select.get('input').trigger('click') diff --git a/tests/unit/Reduce.spec.js b/tests/unit/Reduce.spec.js index 322377f..803e995 100755 --- a/tests/unit/Reduce.spec.js +++ b/tests/unit/Reduce.spec.js @@ -1,11 +1,11 @@ import { it, describe, expect } from 'vitest' import { mount, shallowMount } from '@vue/test-utils' -import VueSelect from '../../src/components/Select.vue' +import VueSelect from '@/components/Select.vue' import { mountDefault } from '../helpers.js' describe('When reduce prop is defined', () => { it('determines when a reducer has been supplied', async () => { - let Select = mountDefault() + const Select = mountDefault() expect(Select.vm.isReducingValues).toBeFalsy() await Select.setProps({ reduce: () => {} }) diff --git a/tests/unit/Selecting.spec.js b/tests/unit/Selecting.spec.js index fc9decb..c6e910c 100755 --- a/tests/unit/Selecting.spec.js +++ b/tests/unit/Selecting.spec.js @@ -1,7 +1,7 @@ import { it, describe, expect, vi, beforeEach, afterEach } from 'vitest' import { mount, shallowMount } from '@vue/test-utils' -import VueSelect from '../../src/components/Select.vue' -import typeAheadPointer from '../../src/mixins/typeAheadPointer.js' +import VueSelect from '@/components/Select.vue' +import typeAheadPointer from '@/mixins/typeAheadPointer.js' import { mountDefault } from '../helpers.js' describe('VS - Selecting Values', () => { diff --git a/tests/unit/Tagging.spec.js b/tests/unit/Tagging.spec.js index 41da19d..640701b 100755 --- a/tests/unit/Tagging.spec.js +++ b/tests/unit/Tagging.spec.js @@ -5,7 +5,7 @@ import { selectTag, selectWithProps, } from '../helpers.js' -import VueSelect from '../../src/components/Select.vue' +import VueSelect from '@/components/Select.vue' describe('When Tagging Is Enabled', () => { it('can determine if a given option string already exists', () => { @@ -147,7 +147,7 @@ describe('When Tagging Is Enabled', () => { }) it('should select an existing option if the search string matches a string from options', async () => { - let two = 'two' + const two = 'two' const Select = selectWithProps({ taggable: true, multiple: true, @@ -160,7 +160,7 @@ describe('When Tagging Is Enabled', () => { }) it('should select an existing option if the search string matches an objects label from options', async () => { - let two = { label: 'two' } + const two = { label: 'two' } const Select = selectWithProps({ taggable: true, options: [{ label: 'one' }, two], @@ -171,7 +171,7 @@ describe('When Tagging Is Enabled', () => { }) it('should select an existing option if the search string matches an objects label from options when filter-options is false', async () => { - let two = { label: 'two' } + const two = { label: 'two' } const Select = selectWithProps({ taggable: true, filterable: false, diff --git a/tests/unit/TypeAhead.spec.js b/tests/unit/TypeAhead.spec.js index 63892bc..56a4e43 100755 --- a/tests/unit/TypeAhead.spec.js +++ b/tests/unit/TypeAhead.spec.js @@ -1,6 +1,6 @@ import { it, describe, expect } from 'vitest' import { shallowMount } from '@vue/test-utils' -import VueSelect from '../../src/components/Select.vue' +import VueSelect from '@/components/Select.vue' import { mountDefault } from '../helpers.js' describe('Moving the Typeahead Pointer', () => { diff --git a/tests/unit/utility/sortAndStringify.spec.js b/tests/unit/utility/sortAndStringify.spec.js index 3ecc3a0..e33cec2 100644 --- a/tests/unit/utility/sortAndStringify.spec.js +++ b/tests/unit/utility/sortAndStringify.spec.js @@ -1,5 +1,5 @@ import { test, expect } from 'vitest' -import sortAndStringify from '../../../src/utility/sortAndStringify' +import sortAndStringify from '@/utility/sortAndStringify' test('it will stringify an object', () => { expect(sortAndStringify({ hello: 'world' })).toEqual('{"hello":"world"}') diff --git a/tests/unit/utility/uniqueId.spec.js b/tests/unit/utility/uniqueId.spec.js index ce9c200..bc9424f 100644 --- a/tests/unit/utility/uniqueId.spec.js +++ b/tests/unit/utility/uniqueId.spec.js @@ -1,5 +1,5 @@ import { test, expect } from 'vitest' -import uniqueId from '../../../src/utility/uniqueId' +import uniqueId from '@/utility/uniqueId' test('it generates a unique number', () => { expect(uniqueId()).not.toEqual(uniqueId())