Skip to content

Commit 9cc7e61

Browse files
Merge pull request #8 from RobotlegsJS/coverage
Improve code coverage
2 parents 60e5cd2 + ad8d9c3 commit 9cc7e61

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

test/org/osflash/signals/SlotListTest.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ describe("SlotListTest", () => {
4444
assert.equal(0, SlotList.NIL.length);
4545
});
4646

47+
it("NIL_can_not_append_a_new_slot", () => {
48+
let list: SlotList = SlotList.NIL.append(slotA);
49+
// list should be a new SlotList with only one element
50+
assert.equal(1, list.length);
51+
// append a element to NIL should not change it's length
52+
assert.equal(0, SlotList.NIL.length);
53+
});
54+
4755
it("tail_defaults_to_NIL_if_omitted_in_constructor", () => {
4856
const noTail: SlotList = new SlotList(slotA);
4957
assert.equal(SlotList.NIL, noTail.tail);

test/org/osflash/signals/SlotTest.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ describe("SlotTest", () => {
6969
assert.deepEqual(received, expected);
7070
});
7171

72+
it("execute0_with_once_enabled_should_remove_listener", () => {
73+
expected = [];
74+
slot = new Slot(listener0, signal, true);
75+
slot.execute0();
76+
assert.deepEqual(received, expected);
77+
});
78+
7279
it("execute1_should_not_call_listener_when_disabled", () => {
7380
slot = new Slot(listener1, signal);
7481
slot.enabled = false;
@@ -100,6 +107,13 @@ describe("SlotTest", () => {
100107
assert.deepEqual(received, expected);
101108
});
102109

110+
it("execute1_with_once_enabled_should_remove_listener", () => {
111+
expected = [42];
112+
slot = new Slot(listener1, signal, true);
113+
slot.execute1(expected[0]);
114+
assert.deepEqual(received, expected);
115+
});
116+
103117
it("execute_should_not_call_listener_when_disabled", () => {
104118
slot = new Slot(listener0, signal);
105119
slot.enabled = false;

0 commit comments

Comments
 (0)