mseemann/angular2-mdl

View on GitHub
projects/core/src/lib/common/boolean-property.spec.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { toBoolean } from "./boolean-property";

describe("toBoolean", () => {
  it("should work for null values", () => {
    expect(toBoolean(null)).toBe(false);

    expect(toBoolean(undefined)).toBe(false);
  });

  it("should work for string values", () => {
    expect(toBoolean("hello")).toBe(true);

    expect(toBoolean("true")).toBe(true);

    expect(toBoolean("")).toBe(true);

    expect(toBoolean("false")).toBe(false);
  });
});