-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
List migration to typescript - continuuation
- Loading branch information
1 parent
a63ea87
commit a29ac7b
Showing
5 changed files
with
99 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Copyright (c) 2015-2018 Robert Rypuła - https://audio-network.rypula.pl | ||
|
||
export const LIST_FACTORY = 'LIST_FACTORY'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) 2015-2018 Robert Rypuła - https://audio-network.rypula.pl | ||
|
||
import List from './list'; | ||
|
||
describe('List', () => { | ||
const SIZE_MAX: number = 4; | ||
let list: List<number>; | ||
|
||
beforeEach(() => { | ||
list = new List<number>(SIZE_MAX); | ||
}); | ||
|
||
it('should clone properly', () => { | ||
let listClone: List<number>; | ||
|
||
list.append(1); | ||
list.append(2); | ||
|
||
listClone = list.clone(); | ||
|
||
expect(listClone.getSizeMax()).toBe(SIZE_MAX); | ||
// TODO more checks | ||
}); | ||
|
||
it('should create proper instance', () => { | ||
expect(list).toBeInstanceOf(List); | ||
}); | ||
|
||
it('should properly add items up to size max', () => { | ||
expect(list.append(1)).toBe(true); | ||
expect(list.append(2)).toBe(true); | ||
expect(list.append(3)).toBe(true); | ||
expect(list.append(4)).toBe(true); | ||
expect(list.append(5)).toBe(false); | ||
}); | ||
|
||
it('should return same size max value as passed to constructor', () => { | ||
expect(list.getSizeMax()).toBe(SIZE_MAX); | ||
}); | ||
|
||
it('should properly update size max and return new value', () => { | ||
const SIZE_MAX_NEW: number = 20; | ||
|
||
list.setSizeMax(SIZE_MAX_NEW); | ||
expect(list.getSizeMax()).toBe(SIZE_MAX_NEW); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
// Copyright (c) 2015-2018 Robert Rypuła - https://audio-network.rypula.pl | ||
|
||
export const COMPLEX = 'COMPLEX'; | ||
export const COMPLEX_FACTORY = 'COMPLEX_FACTORY'; |