mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-12 03:50:22 +00:00
Merge branch 'bpe_issues' into bom
This commit is contained in:
@@ -7,18 +7,16 @@ describe "SidebarCtrl", ->
|
||||
module("Darkswarm")
|
||||
location =
|
||||
path: ->
|
||||
"/test"
|
||||
"/login"
|
||||
inject ($controller, $rootScope) ->
|
||||
scope = $rootScope
|
||||
ctrl = $controller 'SidebarCtrl', {$scope: scope, $location: location}
|
||||
scope.$apply()
|
||||
|
||||
it 'tracks the active sidebar from the $location', ->
|
||||
expect(scope.active_sidebar).toEqual "/test"
|
||||
|
||||
it 'is active when a location is set', ->
|
||||
expect(scope.active()).toEqual "active"
|
||||
expect(scope.active()).toEqual true
|
||||
|
||||
it 'is inactive no location is set', ->
|
||||
scope.active_sidebar = null
|
||||
expect(scope.active()).toEqual null
|
||||
location.path = ->
|
||||
null
|
||||
expect(scope.active()).toEqual false
|
||||
|
||||
@@ -32,3 +32,13 @@ describe 'OrderCycle service', ->
|
||||
$httpBackend.flush()
|
||||
expect(OrderCycle.order_cycle.orders_close_at).toEqual(datestring)
|
||||
|
||||
it "tells us when the order cycle closes", ->
|
||||
OrderCycle.order_cycle.orders_close_at = "test"
|
||||
expect(OrderCycle.orders_close_at()).toEqual "test"
|
||||
|
||||
it "tells us when no order cycle is selected", ->
|
||||
OrderCycle.order_cycle = null
|
||||
expect(OrderCycle.selected()).toEqual false
|
||||
OrderCycle.order_cycle = {test: "blah"}
|
||||
expect(OrderCycle.selected()).toEqual true
|
||||
|
||||
|
||||
@@ -403,8 +403,8 @@ describe 'OrderCycle services', ->
|
||||
coordinator_id: 456
|
||||
coordinator_fees: []
|
||||
exchanges: [
|
||||
{sender_id: 1, receiver_id: 456}
|
||||
{sender_id: 456, receiver_id: 2}
|
||||
{sender_id: 1, receiver_id: 456, incoming: true}
|
||||
{sender_id: 456, receiver_id: 2, incoming: false}
|
||||
]
|
||||
|
||||
it 'initialises order cycle', ->
|
||||
@@ -456,7 +456,7 @@ describe 'OrderCycle services', ->
|
||||
it 'adds the supplier to incoming exchanges', ->
|
||||
OrderCycle.addSupplier('123')
|
||||
expect(OrderCycle.order_cycle.incoming_exchanges).toEqual [
|
||||
{enterprise_id: '123', active: true, variants: {}, enterprise_fees: []}
|
||||
{enterprise_id: '123', incoming: true, active: true, variants: {}, enterprise_fees: []}
|
||||
]
|
||||
|
||||
describe 'adding distributors', ->
|
||||
@@ -465,7 +465,7 @@ describe 'OrderCycle services', ->
|
||||
it 'adds the distributor to outgoing exchanges', ->
|
||||
OrderCycle.addDistributor('123')
|
||||
expect(OrderCycle.order_cycle.outgoing_exchanges).toEqual [
|
||||
{enterprise_id: '123', active: true, variants: {}, enterprise_fees: []}
|
||||
{enterprise_id: '123', incoming: false, active: true, variants: {}, enterprise_fees: []}
|
||||
]
|
||||
|
||||
describe 'removing exchanges', ->
|
||||
@@ -630,12 +630,14 @@ describe 'OrderCycle services', ->
|
||||
expect(OrderCycle.order_cycle.incoming_exchanges).toEqual [
|
||||
sender_id: 1
|
||||
enterprise_id: 1
|
||||
incoming: true
|
||||
active: true
|
||||
]
|
||||
|
||||
expect(OrderCycle.order_cycle.outgoing_exchanges).toEqual [
|
||||
receiver_id: 2
|
||||
enterprise_id: 2
|
||||
incoming: false
|
||||
active: true
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user