-
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.
Merge pull request #3 from echgo/development
fix: Update filename & add package documentation.
- Loading branch information
Showing
6 changed files
with
75 additions
and
33 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -20,3 +20,6 @@ jobs: | |
|
||
- name: Build | ||
run: go build -v ./... | ||
|
||
- name: Test | ||
run: go test -v ./.. |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
# First irgnore all unused folders. | ||
# After that we ignore all other files. | ||
.idea/ | ||
notifile_test.go |
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,22 +1,60 @@ | ||
// Copyright 2022 Jonas Kwiedor. All rights reserved. | ||
// Use of this source code is governed by the MIT | ||
// license that can be found in the LICENSE file. | ||
|
||
package notifile_test | ||
|
||
import ( | ||
"fmt" | ||
"github.com/echgo/notifile" | ||
"os" | ||
"testing" | ||
) | ||
|
||
// TestCreate is to test the create function | ||
func TestCreate(t *testing.T) { | ||
|
||
data := notifile.Data{ | ||
Channels: nil, | ||
Headline: "Testing", | ||
Message: "This is a message about test corners.", | ||
tests := []struct { | ||
path string | ||
channels []string | ||
headline string | ||
message string | ||
}{ | ||
{ | ||
path: os.TempDir(), | ||
channels: []string{"gotify", "smtp"}, | ||
headline: "Testing", | ||
message: "This is the fist message about test corners.", | ||
}, | ||
{ | ||
path: os.TempDir(), | ||
channels: []string{"smtp"}, | ||
headline: "Testing", | ||
message: "This is the second message about test corners.", | ||
}, | ||
{ | ||
path: os.TempDir(), | ||
channels: []string{"trello"}, | ||
headline: "Testing", | ||
message: "This is the third message about test corners.", | ||
}, | ||
} | ||
|
||
err := notifile.Create(data, "/path/to/your/folder") | ||
if err != nil { | ||
t.Fatal(err) | ||
for _, value := range tests { | ||
|
||
data := notifile.Data{ | ||
Channels: value.channels, | ||
Headline: value.headline, | ||
Message: value.message, | ||
} | ||
|
||
fmt.Println(value.path) | ||
|
||
err := notifile.Create(data, value.path) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
} | ||
|
||
} |