'Sort all JavaScript files'

def test_sort_js_files(self):

    files = fd.discover_files(base_path, ext='.js')
    (sources, mocks, specs) = fd.sort_js_files(files)
    self.assertEqual(len(sources), 6)
    self.assertEqual(len(mocks), 2)
    self.assertEqual(len(specs), 6)
    self.assertTrue(sources[0].endswith('.module.js'))
    self.assertTrue(sources[1].endswith('.module.js'))
    self.assertTrue(sources[2].endswith('.controller.js'))
    self.assertTrue(sources[3].endswith('.directive.js'))
    self.assertTrue(sources[4].endswith('.controller.js'))
    self.assertTrue(sources[5].endswith('.directive.js'))
    self.assertTrue(mocks[0].endswith('.mock.js'))
    self.assertTrue(mocks[1].endswith('.mock.js'))
    self.assertTrue(specs[0].endswith('.spec.js'))
    self.assertTrue(specs[1].endswith('.spec.js'))
    self.assertTrue(specs[2].endswith('.spec.js'))
    self.assertTrue(specs[3].endswith('.spec.js'))
    self.assertTrue(specs[4].endswith('.spec.js'))
    self.assertTrue(specs[5].endswith('.spec.js'))
