Skip to content

Commit

Permalink
fix: test (#127) (#128)
Browse files Browse the repository at this point in the history
* fix: test

* remove codecov
  • Loading branch information
hwbrzzl authored Dec 31, 2024
1 parent a8674f6 commit 3974414
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/codecov.yml

This file was deleted.

20 changes: 17 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,21 @@ on:
branches:
- master
pull_request:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_ACCESS_KEY_SECRET: ${{ secrets.AWS_ACCESS_KEY_SECRET }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_BUCKET: ${{ secrets.AWS_BUCKET }}
AWS_URL: ${{ secrets.AWS_URL }}
jobs:
test:
uses: goravel/.github/.github/workflows/test.yml@master
secrets: inherit
ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: Install dependencies
run: go mod tidy
- name: Run tests
run: go test -timeout 1h ./...
23 changes: 12 additions & 11 deletions s3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/gookit/color"
"github.com/stretchr/testify/assert"

filesystemcontract "github.com/goravel/framework/contracts/filesystem"
configmock "github.com/goravel/framework/mocks/config"
contractsfilesystem "github.com/goravel/framework/contracts/filesystem"
mocksconfig "github.com/goravel/framework/mocks/config"
)

func TestStorage(t *testing.T) {
Expand All @@ -24,15 +24,16 @@ func TestStorage(t *testing.T) {

assert.Nil(t, os.WriteFile("test.txt", []byte("Goravel"), 0644))

mockConfig := &configmock.Config{}
mockConfig.On("GetString", "app.timezone").Return("UTC")
mockConfig.On("GetString", "filesystems.disks.s3.key").Return(os.Getenv("AWS_ACCESS_KEY_ID"))
mockConfig.On("GetString", "filesystems.disks.s3.secret").Return(os.Getenv("AWS_ACCESS_KEY_SECRET"))
mockConfig.On("GetString", "filesystems.disks.s3.region").Return(os.Getenv("AWS_DEFAULT_REGION"))
mockConfig.On("GetString", "filesystems.disks.s3.bucket").Return(os.Getenv("AWS_BUCKET"))
mockConfig.On("GetString", "filesystems.disks.s3.url").Return(os.Getenv("AWS_URL"))
mockConfig := &mocksconfig.Config{}
mockConfig.EXPECT().GetString("app.timezone").Return("UTC")
mockConfig.EXPECT().GetString("filesystems.disks.s3.key").Return(os.Getenv("AWS_ACCESS_KEY_ID"))
mockConfig.EXPECT().GetString("filesystems.disks.s3.secret").Return(os.Getenv("AWS_ACCESS_KEY_SECRET"))
mockConfig.EXPECT().GetString("filesystems.disks.s3.region").Return(os.Getenv("AWS_DEFAULT_REGION"))
mockConfig.EXPECT().GetString("filesystems.disks.s3.bucket").Return(os.Getenv("AWS_BUCKET"))
mockConfig.EXPECT().GetString("filesystems.disks.s3.url").Return(os.Getenv("AWS_URL"))
mockConfig.EXPECT().GetString("filesystems.disks.s3.token", "").Return("")

var driver filesystemcontract.Driver
var driver contractsfilesystem.Driver
url := os.Getenv("AWS_URL")

tests := []struct {
Expand Down Expand Up @@ -404,7 +405,7 @@ type File struct {
path string
}

func (f *File) Disk(disk string) filesystemcontract.File {
func (f *File) Disk(disk string) contractsfilesystem.File {
return &File{}
}

Expand Down

0 comments on commit 3974414

Please sign in to comment.