mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-06 02:51:34 +00:00
Adjust specs
This commit is contained in:
@@ -299,13 +299,6 @@ describe "AdminProductEditCtrl", ->
|
||||
$scope.$digest()
|
||||
expect($scope.resetProducts).toHaveBeenCalled()
|
||||
|
||||
it "sets the loading property to true before fetching products and unsets it when loading is complete", ->
|
||||
$scope.fetchProducts()
|
||||
expect($scope.loading).toEqual true
|
||||
$scope.$digest()
|
||||
expect($scope.loading).toEqual false
|
||||
|
||||
|
||||
describe "resetting products", ->
|
||||
beforeEach ->
|
||||
spyOn DirtyProducts, "clear"
|
||||
|
||||
@@ -8,35 +8,6 @@ describe "BulkProducts service", ->
|
||||
BulkProducts = _BulkProducts_
|
||||
$httpBackend = _$httpBackend_
|
||||
|
||||
describe "fetching products", ->
|
||||
beforeEach ->
|
||||
spyOn BulkProducts, 'addProducts'
|
||||
|
||||
it "makes a standard call to dataFetcher when no filters exist", ->
|
||||
$httpBackend.expectGET("/api/products/bulk_products?page=1;per_page=20;").respond "list of products"
|
||||
BulkProducts.fetch [], ->
|
||||
$httpBackend.flush()
|
||||
|
||||
it "makes more calls to dataFetcher if more pages exist", ->
|
||||
$httpBackend.expectGET("/api/products/bulk_products?page=1;per_page=20;").respond { products: [], pages: 2 }
|
||||
$httpBackend.expectGET("/api/products/bulk_products?page=2;per_page=20;").respond { products: ["list of products"] }
|
||||
BulkProducts.fetch [], ->
|
||||
$httpBackend.flush()
|
||||
|
||||
it "applies filters when they are supplied", ->
|
||||
filter =
|
||||
property:
|
||||
name: "Name"
|
||||
db_column: "name"
|
||||
predicate:
|
||||
name: "Equals"
|
||||
predicate: "eq"
|
||||
value: "Product1"
|
||||
$httpBackend.expectGET("/api/products/bulk_products?page=1;per_page=20;q[name_eq]=Product1;").respond "list of products"
|
||||
BulkProducts.fetch [filter], ->
|
||||
$httpBackend.flush()
|
||||
|
||||
|
||||
describe "cloning products", ->
|
||||
it "clones products using a http post request to /api/products/(id)/clone", ->
|
||||
BulkProducts.products = [
|
||||
|
||||
Reference in New Issue
Block a user