|
| 1 | +import { expect, test } from 'vitest' |
| 2 | +import { shallowMount } from '@vue/test-utils' |
| 3 | +import NacoStubCreateModal from '@/components/panels/edit/modals/NacoStubCreateModal.vue' |
| 4 | + |
| 5 | + |
| 6 | +const sorSemi = 'Timothy R. Amidon; Ehren Helmut Pflugfelder; Daniel P. Richards; Donnie Johnson Sackey' |
| 7 | +const sorSpaceSemi = 'Timothy R. Amidon ; Ehren Helmut Pflugfelder ; Daniel P. Richards ; Donnie Johnson Sackey' |
| 8 | +const sorSpaceMixedSemi = 'Timothy R. Amidon ; Ehren Helmut Pflugfelder; Daniel P. Richards ; Donnie Johnson Sackey' |
| 9 | +const sorSemiAnd = 'Timothy R. Amidon; Ehren Helmut Pflugfelder; Daniel P. Richards and Donnie Johnson Sackey' |
| 10 | +const sorSemisAnd = 'Timothy R. Amidon; Ehren Helmut Pflugfelder; Daniel P. Richards; and Donnie Johnson Sackey' |
| 11 | + |
| 12 | +const sorSemiAmp = 'Timothy R. Amidon; Ehren Helmut Pflugfelder; Daniel P. Richards & Donnie Johnson Sackey' |
| 13 | +const sorSemisAmp = 'Timothy R. Amidon; Ehren Helmut Pflugfelder; Daniel P. Richards; & Donnie Johnson Sackey' |
| 14 | + |
| 15 | +const sorSemiUnd = 'Timothy R. Amidon; Ehren Helmut Pflugfelder; Daniel P. Richards und Donnie Johnson Sackey' |
| 16 | +const sorSemisUnd = 'Timothy R. Amidon; Ehren Helmut Pflugfelder; Daniel P. Richards; und Donnie Johnson Sackey' |
| 17 | + |
| 18 | +const sorCommas = 'Timothy R. Amidon, Ehren Helmut Pflugfelder, Daniel P. Richards, Donnie Johnson Sackey' |
| 19 | +const sorCommasAnd = 'Timothy R. Amidon, Ehren Helmut Pflugfelder, Daniel P. Richards, and Donnie Johnson Sackey' |
| 20 | +const sorCommaAnd = 'Timothy R. Amidon, Ehren Helmut Pflugfelder, Daniel P. Richards and Donnie Johnson Sackey' |
| 21 | + |
| 22 | +const sorCommasUnd = 'Timothy R. Amidon, Ehren Helmut Pflugfelder, Daniel P. Richards, und Donnie Johnson Sackey' |
| 23 | +const sorCommasAmp = 'Timothy R. Amidon, Ehren Helmut Pflugfelder, Daniel P. Richards, & Donnie Johnson Sackey' |
| 24 | + |
| 25 | +const sorCommaUnd = 'Timothy R. Amidon, Ehren Helmut Pflugfelder, Daniel P. Richards und Donnie Johnson Sackey' |
| 26 | +const sorCommaAmp = 'Timothy R. Amidon, Ehren Helmut Pflugfelder, Daniel P. Richards & Donnie Johnson Sackey' |
| 27 | + |
| 28 | + |
| 29 | +const sorAnd = 'Timothy R. Amidon and Ehren Helmut Pflugfelder and Daniel P. Richards and Donnie Johnson Sackey' |
| 30 | + |
| 31 | +const resultExpected = ['Timothy R. Amidon', 'Ehren Helmut Pflugfelder', 'Daniel P. Richards', 'Donnie Johnson Sackey'] |
| 32 | + |
| 33 | +describe('SOR Splitting', () => { |
| 34 | + |
| 35 | + test('Only Semicolons', async () => { |
| 36 | + let split = NacoStubCreateModal.methods.splitSor(sorSemi) |
| 37 | + expect(split).toStrictEqual(resultExpected) |
| 38 | + }); |
| 39 | + |
| 40 | + test('<space> Semicolons', async () => { |
| 41 | + let split = NacoStubCreateModal.methods.splitSor(sorSpaceSemi) |
| 42 | + expect(split).toStrictEqual(resultExpected) |
| 43 | + }); |
| 44 | + |
| 45 | + test('Mixed spaced semicolons', async () => { |
| 46 | + let split = NacoStubCreateModal.methods.splitSor(sorSpaceMixedSemi) |
| 47 | + expect(split).toStrictEqual(resultExpected) |
| 48 | + }); |
| 49 | + |
| 50 | + test('semicolons with "and"', async () => { |
| 51 | + let split = NacoStubCreateModal.methods.splitSor(sorSemiAnd) |
| 52 | + expect(split).toStrictEqual(resultExpected) |
| 53 | + }); |
| 54 | + |
| 55 | + test('semicolons with "; and"', async () => { |
| 56 | + let split = NacoStubCreateModal.methods.splitSor(sorSemisAnd) |
| 57 | + expect(split).toStrictEqual(resultExpected) |
| 58 | + }); |
| 59 | + |
| 60 | + test('semicolons with "&"', async () => { |
| 61 | + let split = NacoStubCreateModal.methods.splitSor(sorSemiAmp) |
| 62 | + expect(split).toStrictEqual(resultExpected) |
| 63 | + }); |
| 64 | + |
| 65 | + test('semicolons with "; &"', async () => { |
| 66 | + let split = NacoStubCreateModal.methods.splitSor(sorSemisAmp) |
| 67 | + expect(split).toStrictEqual(resultExpected) |
| 68 | + }); |
| 69 | + |
| 70 | + test('semicolons with "und"', async () => { |
| 71 | + let split = NacoStubCreateModal.methods.splitSor(sorSemiUnd) |
| 72 | + expect(split).toStrictEqual(resultExpected) |
| 73 | + }); |
| 74 | + |
| 75 | + test('semicolons with "; und"', async () => { |
| 76 | + let split = NacoStubCreateModal.methods.splitSor(sorSemisUnd) |
| 77 | + expect(split).toStrictEqual(resultExpected) |
| 78 | + }); |
| 79 | + |
| 80 | + test('only commas', async () => { |
| 81 | + let split = NacoStubCreateModal.methods.splitSor(sorCommas) |
| 82 | + expect(split).toStrictEqual(resultExpected) |
| 83 | + }); |
| 84 | + |
| 85 | + test('commas with ", and"', async () => { |
| 86 | + let split = NacoStubCreateModal.methods.splitSor(sorCommasAnd) |
| 87 | + expect(split).toStrictEqual(resultExpected) |
| 88 | + }); |
| 89 | + |
| 90 | + test('commas with "and"', async () => { |
| 91 | + let split = NacoStubCreateModal.methods.splitSor(sorCommaAnd) |
| 92 | + expect(split).toStrictEqual(resultExpected) |
| 93 | + }); |
| 94 | + |
| 95 | + test('commas with "und"', async () => { |
| 96 | + let split = NacoStubCreateModal.methods.splitSor(sorCommaUnd) |
| 97 | + expect(split).toStrictEqual(resultExpected) |
| 98 | + }); |
| 99 | + |
| 100 | + test('commas with "&"', async () => { |
| 101 | + let split = NacoStubCreateModal.methods.splitSor(sorCommaAmp) |
| 102 | + expect(split).toStrictEqual(resultExpected) |
| 103 | + }); |
| 104 | + |
| 105 | + test('commas with ", und"', async () => { |
| 106 | + let split = NacoStubCreateModal.methods.splitSor(sorCommasUnd) |
| 107 | + expect(split).toStrictEqual(resultExpected) |
| 108 | + }); |
| 109 | + |
| 110 | + test('commas with ", &"', async () => { |
| 111 | + let split = NacoStubCreateModal.methods.splitSor(sorCommasAmp) |
| 112 | + expect(split).toStrictEqual(resultExpected) |
| 113 | + }); |
| 114 | + |
| 115 | + test('Only "and"', async () => { |
| 116 | + let split = NacoStubCreateModal.methods.splitSor(sorAnd) |
| 117 | + expect(split).toStrictEqual(resultExpected) |
| 118 | + }); |
| 119 | + |
| 120 | + |
| 121 | +}) |
0 commit comments