Ryan Chandler 5 gadi atpakaļ
vecāks
revīzija
2f82c6af54
1 mainītis faili ar 35 papildinājumiem un 0 dzēšanām
  1. 35 0
      tests/store.spec.js

+ 35 - 0
tests/store.spec.js

@@ -0,0 +1,35 @@
+import Spruce from '../dist/spruce'
+
+beforeEach(() => {
+    Spruce.stores = {}
+})
+
+test('Spruce.store() > namespace and data set correctly', () => {
+    Spruce.store('testing', {
+        foo: 'bar'
+    })
+
+    expect(Spruce.stores.testing).toEqual({
+        foo: 'bar'
+    })
+
+    expect(Spruce.stores.testing.foo).toEqual('bar')
+})
+
+test('Spruce.store() > existing namespace will not be overwritten', () => {
+    Spruce.store('testing', {
+        foo: 'bar'
+    })
+
+    expect(Spruce.stores.testing).toEqual({
+        foo: 'bar'
+    })
+
+    Spruce.store('testing', {
+        bob: 'car'
+    })
+
+    expect(Spruce.stores.testing).toEqual({
+        foo: 'bar'
+    })
+})