Changeset - 9f2498ffdd4e
[Not reviewed]
default
0 0 3
Laman - 5 years ago 2019-06-29 14:49:04

Jasmine tests
3 files changed with 39 insertions and 0 deletions:
0 comments (0 inline, 0 general)
.hgignore
Show inline comments
 
new file 100644
 
^nbproject/
spec/support/jasmine.json
Show inline comments
 
new file 100644
 
{
 
  "spec_dir": "spec",
 
  "spec_files": [
 
    "**/*[sS]pec.js"
 
  ],
 
  "helpers": [
 
    "helpers/**/*.js"
 
  ],
 
  "stopSpecOnExpectationFailure": false,
 
  "random": true
 
}
spec/test/utilSpec.js
Show inline comments
 
new file 100644
 
/* global expect */
 

	
 
describe("Util",function(){
 
  var util = require("../../util.js");
 
	var utf=[ // https://tools.ietf.org/html/rfc3629#page-8
 
		["",[]],
 
		["abc",[97,98,99]],
 
		["å",[195,165]],
 
		["🚅",[240,159,154,133]],
 
		["žír",[0xc5,0xbe,0xc3,0xad,114]],
 
		["A\u2262\u0391.",[0x41,0xE2,0x89,0xA2,0xCE,0x91,0x2E]],
 
		["\uD55C\uAD6D\uC5B4",[0xED,0x95,0x9C,0xEA,0xB5,0xAD,0xEC,0x96,0xB4]],
 
		["\ud84c\udfb4",[0xf0,0xa3,0x8e,0xb4]]
 
	];
 
	
 
	describe("str2utf8",function(){
 
		it("should encode a String into bytes in UTF-8",function(){
 
			utf.forEach(couple=>expect(util.str2utf8(couple[0])).toEqual(couple[1]));
 
		});
 
	});
 
	
 
	describe("utf82str",function(){
 
		it("should decode a String from UTF-8 bytes",function(){
 
			utf.forEach(couple=>expect(util.utf82str(couple[1])).toEqual(couple[0]));
 
		});
 
	});
 
});
0 comments (0 inline, 0 general)