It's clear by looking into the code. Probably if you are testing currentDate, startOfWeek and endOfWeek, then you don;t need the UNIT test as it's been already tested via library: http://momentjs.com/tests/
However if you are manipulating some dates such as Last 7/14/30 days, then you can create your unit test for the same. On Mon, May 4, 2015 at 9:50 AM, Lucas Perea <[email protected]> wrote: > Hi! > > I'm trying to make unit tests for a controller that uses moment.js to > handle three dates of a week. My testing framework is jasmine and my > AngularJS version is v1.3.15 > > Basically I have an init() function that sets them and I want to check if > all of them are properly set in the controller. > > > var myController = this; > > myController.init = function () { > myController.currentDate = moment(new > Date()).format('DD-MM-YYYY'); > myController.startOfWeek = > moment(currentDate).startOf('week').format('DD-MM-YYYY'); > myController.endOfWeek = > moment(currentDate).startOf('week').format('DD-MM-YYYY'); > }; > > At this point I'm not sure if this approach is correct and/or if I should > test this stuff here. > > Thanks in advance! > > -- > You received this message because you are subscribed to the Google Groups > "AngularJS" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. > -- *Rishi Tandon* Pearson Learning Technology Group Mobile: (310) 926-9032 Pearson Always Learning Learn more at www.pearson.com -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
