Public Access
feat(import): read the exports of GOG Galaxy, Grouvee, HowLongToBeat and Playnite
This commit is contained in:
1 parent
89d0b29698
commit
8e31eafc06
14 files changed
+289
-26
No files matched your search
@@ -134,6 +134,26 @@ describe('ImportPage', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('reads an export file by its format and sends that as the source', async () => {
|
||||
renderPage({
|
||||
'GET ': json(200, {imports: []}),
|
||||
'POST ': json(202, {id: 9}),
|
||||
'GET /9': json(200, {id: 9, source: 'GROUVEE', status: 'MATCHING', total: 1, matched: 0}),
|
||||
});
|
||||
fireEvent.click(await screen.findByRole('button', {name: 'IMPORT.SOURCE_CSV'}));
|
||||
const file = new File(['id,name,shelves,platforms,dates\n1,Hades,"{""Playing"": {}}","{""PC"": {}}",None\n'],
|
||||
'grouvee.csv', {type: 'text/csv'});
|
||||
fireEvent.change(screen.getByLabelText('IMPORT.CSV_LABEL'), {target: {files: [file]}});
|
||||
|
||||
expect(await screen.findByText('IMPORT.FORMAT_READ')).toBeTruthy();
|
||||
fireEvent.click(screen.getByRole('button', {name: 'IMPORT.START'}));
|
||||
|
||||
await screen.findByText('IMPORT.MATCHING');
|
||||
expect(JSON.parse(posted('POST', '/imports')[1].body)).toEqual({
|
||||
source: 'GROUVEE', rows: [{title: 'Hades', platform: 'PC', playtimeMinutes: null, status: 'PLAYING'}],
|
||||
});
|
||||
});
|
||||
|
||||
it('polls while matching and then shows the review', async () => {
|
||||
let calls = 0;
|
||||
renderPage({
|
||||
|
||||
Reference in new issue
Block a user