Array Assertions - dylanparry/ceylon GitHub Wiki
expect(item: T[]).toInclude(value: T, message?: string): this;Asserts that the array item includes value.
Outputs an optional message in case of a failed assertion.
expect([1, 2, 3]).toInclude(2);
expect([1, 2, 3]).toInclude(4); // Assertion Error- toContain
expect(item: T[]).toExclude(value: T, message?: string): this;Asserts that the array item does not include value.
Outputs an optional message in case of a failed assertion.
expect([1, 2, 3]).toExclude(4);
expect([1, 2, 3]).toExclude(2); // Assertion Error- toNotInclude
- toNotContain
expect(item: T[]).toIncludeKey(key: number, message?: string): this;Asserts that the array item includes the key.
Outputs an optional message in case of a failed assertion.
expect([1, 2, 3]).toIncludeKey(0);
expect([1, 2, 3]).toIncludeKey(3); // Assertion Error- toContainKey
expect(item: T[]).toExcludeKey(key: number, message?: string): this;Asserts that the array item does not include the key.
Outputs an optional message in case of a failed assertion.
expect([1, 2, 3]).toExcludeKey(3);
expect([1, 2, 3]).toExcludeKey(0); // Assertion Error- toNotIncludeKey
- toNotContainKey
expect(item: T[]).toIncludeKeys(keys: number[], message?: string): this;Asserts that the array item contains all of the keys.
Outputs an optional message in case of a failed assertion.
expect([1, 2, 3]).toIncludeKeys([0, 1, 2]);
expect([1, 2, 3]).toIncludeKeys([3, 4]); // Assertion Error- toContainKeys
expect(item: T[]).toExcludeKeys(keys: number[], message?: string): this;Asserts that the array item does not contain any of the keys.
Outputs an optional message in case of a failed assertion.
expect([1, 2, 3]).toExcludeKeys([3, 4]);
expect([1, 2, 3]).toExcludeKeys([0, 1, 2]); // Assertion Error- toNotIncludeKeys
- toNotContainKeys
expect(item: T[]).toHaveLength(value: number, message?: string): this;Asserts that the number of items contained in the array item is equal to value.
Outputs an optional message in case of a failed assertion.
expect([1, 2, 3]).toHaveLength(3);
expect([1, 2, 3]).toHaveLength(4); // Assertion Error