https://github.com/khulnasoft-lab/bolt-fixtures
https://github.com/khulnasoft-lab/bolt-fixtures
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/khulnasoft-lab/bolt-fixtures
- Owner: khulnasoft-lab
- License: apache-2.0
- Created: 2024-05-20T17:26:50.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-11-10T17:41:27.000Z (6 months ago)
- Last Synced: 2025-01-26T14:08:48.063Z (4 months ago)
- Language: Go
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bolt-fixtures
Test fixtures for [BoltDB](https://github.com/etcd-io/bbolt). Write tests against a real database.## Prepare test data
Example YAML fixture:
```
- bucket: abc
pairs:
- bucket: def
pairs:
- key: ghi
value: jkl
- bucket: mno
pairs:
- key: pqr
value: stu
- key: vwx
value:
foo: abc
bar: 123
```## Load into BoltDB
Example integration for your project:
```
func TestSomething(t *testing.T) {
f, _ := ioutil.TempFile("", "TestSomething")
defer os.Remove(f.Name())fixtureFiles := []string{"testdata/test.yaml"}
l, _ := fixtures.New(f.Name(), fixtureFiles)
defer l.Close()_ = l.Load()
// do something
}
```