Categorygithub.com/khulnasoft-lab/boltdb-fixtures
repositorypackage
1.0.0
Repository: https://github.com/khulnasoft-lab/boltdb-fixtures.git
Documentation: pkg.go.dev

# README

boltdb-fixtures

Test fixtures for BoltDB. 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
}