Skip to content

Commit

Permalink
Ensure sdf raw zip exists for tests to work
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Nemere committed Nov 5, 2024
1 parent 5b0937f commit c075e98
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 2 additions & 0 deletions api/dataimport/sdfToRSI/scanSDF_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package sdfToRSI
import "fmt"

func Example_scanSDF() {
ensureSDFRawExists()

refs, err := scanSDF("./test-data/BadPath.txt")
fmt.Printf("%v|%v\n", len(refs), err)

Expand Down
20 changes: 12 additions & 8 deletions api/dataimport/sdfToRSI/sdfToRSI_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ import (
)

func Example_ConvertSDFtoRSI() {
ensureSDFRawExists()

fmt.Printf("Mkdir output: %v\n", os.MkdirAll("./output", 0644))
files, rtts, err := ConvertSDFtoRSIs("./test-data/sdf_raw.txt", "./output/")
fmt.Printf("%v, %v: %v\n", files, rtts, err)

// Output:
// Mkdir output: <nil>
// [RSI-208536069.csv RSI-208601602.csv], [208536069 208601602]: <nil>
}

func ensureSDFRawExists() {
// If it's not here, unzip it
_, err := os.Stat("./test-data/sdf_raw.txt")
if err != nil {
Expand Down Expand Up @@ -39,12 +51,4 @@ func Example_ConvertSDFtoRSI() {
}
}
}

fmt.Printf("Mkdir output: %v", os.MkdirAll("./output", 0644))
files, rtts, err := ConvertSDFtoRSIs("./test-data/sdf_raw.txt", "./output/")
fmt.Printf("%v, %v: %v\n", files, rtts, err)

// Output:
// Mkdir output: <nil>
// [RSI-208536069.csv RSI-208601602.csv], [208536069 208601602]: <nil>
}

0 comments on commit c075e98

Please sign in to comment.