-
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.
test: Add more tests and run prettier
- Loading branch information
Showing
7 changed files
with
35 additions
and
11 deletions.
There are no files selected for viewing
Binary file not shown.
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 |
---|---|---|
@@ -1,7 +1,12 @@ | ||
import { http } from "msw"; | ||
import { http } from 'msw' | ||
|
||
export const handlers = [ | ||
http.get(`http://portal.cgna.decea.mil.br/files/abas/:date/painel_rpl/companhias/Cia_GLO_CS.txt`, ({ params }) => { | ||
return new Response(null, { status: params.date === '2022-08-22' ? 200 : 404 }) | ||
}) | ||
http.get( | ||
`http://portal.cgna.decea.mil.br/files/abas/:date/painel_rpl/companhias/Cia_GLO_CS.txt`, | ||
({ params }) => { | ||
return new Response(null, { | ||
status: params.date === '2022-08-22' ? 200 : 404, | ||
}) | ||
} | ||
), | ||
] |
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
15 changes: 15 additions & 0 deletions
15
packages/rpl-crawler/src/rpl-file-lines-extractor/index.test.ts
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,15 @@ | ||
import { readFile } from 'fs/promises' | ||
import path from 'path' | ||
import { test, expect } from 'vitest' | ||
import rplFileLinesExtractor from '.' | ||
|
||
test('It extracts the lines from the zip file', async () => { | ||
const file = await readFile( | ||
path.join(__dirname, '../../__mocks__/RPL_NAVBRASIL.zip') | ||
) | ||
const lines = rplFileLinesExtractor(file) | ||
|
||
expect(lines).toEqual([ | ||
`161123 161123 0004000 ACN5135 C208/L SBAC1730 N0155 065 DCT 0427S03754W/N0150F080 IFR DCT SBFZ0030 EQPT/SDFGR/S PBN/B2C2D2O2S1 OPR/AZUL CONECTA LTDA PER/A RMK/JAH VOADO VMC`, | ||
]) | ||
}) |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { defineConfig } from "vitest/config"; | ||
import { defineConfig } from 'vitest/config' | ||
|
||
export default defineConfig({ | ||
test: { | ||
setupFiles: './setup-test.ts' | ||
} | ||
setupFiles: './setup-test.ts', | ||
}, | ||
}) |