-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improves coordinate validation and context (#47)
* switching to official json-bigint to fix search test issues * improving cone search coord and context * improving search form coords * cleanup * cleaning up coord/id validation rules * expand first about panel * test mocking axios * test mocking axios
- Loading branch information
Showing
8 changed files
with
152 additions
and
29 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { vi, describe, it, expect, beforeEach } from 'vitest' | ||
import { mount } from '@vue/test-utils' | ||
|
||
import { createVuetify } from 'vuetify' | ||
import * as components from 'vuetify/components' | ||
import * as directives from 'vuetify/directives' | ||
|
||
// must load this if component uses pinia store, even if not directly used in test | ||
import { createTestingPinia } from '@pinia/testing' | ||
|
||
import Search from '../Search.vue' | ||
|
||
// Mock the specific axiosInstance | ||
vi.mock('@/axios', () => ({ | ||
default: { | ||
get: vi.fn(() => Promise.resolve({ data: 'mocked data' })), | ||
post: vi.fn(), | ||
// Add other methods as needed | ||
}, | ||
})); | ||
|
||
describe('Search', () => { | ||
const vuetify = createVuetify({ components, directives }) | ||
const pinia = createTestingPinia() | ||
|
||
|
||
let wrapper | ||
|
||
beforeEach(() => { | ||
wrapper = mount(Search, { | ||
global: { | ||
plugins: [vuetify, pinia] | ||
}, | ||
props: { | ||
files: [] | ||
} | ||
}) | ||
}) | ||
|
||
it.each([ | ||
['123.45,67.89', '123.45', '67.89'], | ||
['123.45, -67.89', '123.45', '-67.89'], | ||
['123.45 +67.89', '123.45', '+67.89'], | ||
['21:00:33.6 +25:17:56.4', '21:00:33.6', '+25:17:56.4'], | ||
['21 00 33.6 25 17 56.4', '21 00 33.6', '25 17 56.4'], | ||
['21h03m07.2s, -03d12m00s', '21h03m07.2s', '-03d12m00s'], | ||
['21h 03m 07.2s -03d 12m 00s', '21h 03m 07.2s', '-03d 12m 00s'] | ||
])('splits coordinates "%s" into ra and dec', (coords, expRa, expDec) => { | ||
const extract_coords = wrapper.vm.extract_coords | ||
const [ra, dec] = extract_coords(coords) | ||
expect(ra).toBe(expRa) | ||
expect(dec).toBe(expDec) | ||
}) | ||
|
||
|
||
}) |
Oops, something went wrong.