Skip to content

Add easy testing for XML and Javascript content-types, and UTF-8 charset #26

@nfreear

Description

@nfreear

I love the existing support for JSON, HTML and text:

expect(req).to.be.html;

I propose extending this:

expect(req).to.be.xml;
expect(req).to.be.javascript;

The proposed solution makes some assumptions:

  1. The expected content-type for XML is application/xml
  2. The expected content-type for Javascript is text/javascript - I suggest this is still the norm on servers despite application/javascript being more correct.

I'm also interested in testing the character encoding:

expect(res).to.be.utf8;   // Check for "charset=UTF-8" - case sensitive :(

My use-case is @nfreear/ou-media-player-test ../test/ou-podcast-test.js

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions