started Task 3
This commit is contained in:
parent
749fe3a3fb
commit
05bda05ad7
|
@ -8,3 +8,4 @@ meinPlayer.play(meinSong)
|
||||||
if(meinPlayer.isPlaying){
|
if(meinPlayer.isPlaying){
|
||||||
console.log(meinPlayer.currentlyPlayingSong.title)
|
console.log(meinPlayer.currentlyPlayingSong.title)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
function parseToProto(json, proto){
|
||||||
|
return Object.assign(Object.create(proto), JSON.parse(json))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = { parseToProto}
|
|
@ -0,0 +1,15 @@
|
||||||
|
describe("parseToProto", function() {
|
||||||
|
var obj;
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
let proto = {category: "animal"}
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should have category, type, name and age attribute", function() {
|
||||||
|
let obj = parseToProto('{"type": "cat", "name":"Mimi","age":3}', proto)
|
||||||
|
expect("animal").toEqual(obj.category);
|
||||||
|
expect("cat").toEqual(obj.type);
|
||||||
|
expect("Mimi").toEqual(obj.name);
|
||||||
|
expect(3).toEqual(obj.age);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue