fork/gdu

git clone https://git.julia.blue/fork/gdu

ShivamB25feat: customize JSON export attributes (#605)d062e88

subvolume
739 B27 linesraw
1package fs
2
3import (
4	"testing"
5
6	"github.com/stretchr/testify/assert"
7)
8
9func TestJSONAttributesIncludes(t *testing.T) {
10	t.Run("nil set includes every attribute", func(t *testing.T) {
11		var attributes JSONAttributes
12		assert.True(t, attributes.Includes("asize"))
13		assert.True(t, attributes.Includes("anything"))
14	})
15
16	t.Run("empty set includes nothing", func(t *testing.T) {
17		attributes := JSONAttributes{}
18		assert.False(t, attributes.Includes("asize"))
19	})
20
21	t.Run("selected set includes only its members", func(t *testing.T) {
22		attributes := JSONAttributes{"asize": {}, "dsize": {}}
23		assert.True(t, attributes.Includes("asize"))
24		assert.True(t, attributes.Includes("dsize"))
25		assert.False(t, attributes.Includes("items"))
26	})
27}