Skip to content

Commit

Permalink
chore: Add T on timestamp and default num of notes to 500 (#7)
Browse files Browse the repository at this point in the history
* chore: Add T on timestamp and default num of notes to 500

* chore: add matrix for tests

* fix: test
  • Loading branch information
danielnetop authored Nov 25, 2023
1 parent 685f4bd commit da96a4e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 40 deletions.
46 changes: 11 additions & 35 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,42 +45,18 @@ jobs:
skip-build-cache: true
skip-pkg-cache: true

tests-on-windows:
name: Run unit tests on windows
test:
name: Run unit tests
needs: golangci-lint
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}

- name: Run unit tests
run: make.exe test-unit

tests-on-macos:
name: Run unit tests on macos
needs: golangci-lint
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}

- name: Run unit tests
run: make test-unit

tests-on-unix:
name: Run unit tests on linux
needs: golangci-lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [
"macos-latest",
"ubuntu-latest",
"windows-latest"
]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions internal/sn/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type Item struct {
UpdatedAt string `json:"updated_at"`
UUID uuid.UUID `json:"uuid"`
}

type AppData struct {
OrgStandardnotesSn map[string]string `json:"org.standardnotes.sn"`
}
9 changes: 6 additions & 3 deletions internal/sn/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ import (
"github.com/danielnetop/notesnook-to-standardnotes/internal/time"
)

const numOfNotesPerFile = "NUM_OF_NOTES_PER_FILE"
const (
numOfNotesPerFileVar = "NUM_OF_NOTES_PER_FILE"
numOfNotesPerFile = 500
)

var (
notebooks = make(map[string]notesnook.NotebookInfo, 0)
Expand Down Expand Up @@ -194,9 +197,9 @@ func ProcessConversionAndSaveToFile(nooks []notesnook.Nook) error {
storeDataInMaps(nook, tipTaps)
}

numOfNotes, err := strconv.Atoi(os.Getenv(numOfNotesPerFile))
numOfNotes, err := strconv.Atoi(os.Getenv(numOfNotesPerFileVar))
if err != nil {
numOfNotes = 200
numOfNotes = numOfNotesPerFile
}

return splitAndStoreConvertedNotes(convertNotesnookToStandardNotes(nooks), numOfNotes, 1)
Expand Down
2 changes: 1 addition & 1 deletion internal/time/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package time
import "time"

func MilliToTime(milli int64) string {
return time.UnixMilli(milli).UTC().Format("2006-01-02 15:04:05Z")
return time.UnixMilli(milli).UTC().Format("2006-01-02T15:04:05Z")
}
2 changes: 1 addition & 1 deletion internal/time/time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func TestMilliToTime(t *testing.T) {
}{
{
milli: 1699404581000,
want: "2023-11-08 00:49:41Z",
want: "2023-11-08T00:49:41Z",
},
}
for _, tt := range tests {
Expand Down

0 comments on commit da96a4e

Please sign in to comment.