Skip to content

Commit

Permalink
rename variables in main spec
Browse files Browse the repository at this point in the history
  • Loading branch information
mparaiso committed Sep 28, 2015
1 parent a64a7ac commit f35bf6b
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions test/ts/main.ts
@@ -1,27 +1,43 @@
// tiger-reader is an opensource rss reader
// Copyright (C) 2015 mparaiso <mparaiso@online.fr>
//
// tiger-reader program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// tiger-reader program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with tiger-reader program. If not, see <http://www.gnu.org/licenses/>.

/// <reference path="./../../typings/tsd.d.ts" />

import {OrderByPipe} from './../../ts/pipes';


describe("pipes", function() {

beforeEach(function() {
this.orderBy = new OrderByPipe()
this.array = [
{ firstname: 'Brian',lastname:'French' },
{ firstname: 'Christopher',lastname:'Galvin' },
{ firstname: 'Alexander',lastname:'Galvin' }
{ firstname: 'Christopher', lastname: 'Galvin' },
{ firstname: 'Brian', lastname: 'French' },
{ firstname: 'Alexander', lastname: 'Galvin' }
]
})
describe('OrderByPipe', function() {
it('should sort an array correcty', function() {
let res = this.orderBy.transform(this.array, ['firstname']);
expect(res[0].firstname).toBe('Alexander')
describe('given a pipe OrderByPipe', function() {
it('it should sort an array correcty', function() {
let result = this.orderBy.transform(this.array, ['firstname']);
expect(result[0].firstname).toBe('Alexander')
})
it('should sort an array correct when using multiple properties',function(){
let res1 = this.orderBy.transform(this.array,['lastname','firstname'])
expect(res1[0].firstname).toBe('Brian')
expect(res1[2].firstname).toBe('Christopher')
it('it should sort an array correctly when using multiple properties', function() {
let result = this.orderBy.transform(this.array, ['lastname', 'firstname'])
expect(result[0].firstname).toBe('Brian')
expect(result[2].firstname).toBe('Christopher')
})
})
})
Expand Down

0 comments on commit f35bf6b

Please sign in to comment.