{"size": 1275, "ext": "js", "max_stars_repo_path": "test/memoryListTest.js", "max_stars_repo_name": "tcsk/eke-rtt-hw", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/memoryListTest.js", "max_issues_repo_name": "tcsk/eke-rtt-hw", "max_issues_repo_issues_event_min_datetime": "2019-12-30T11:46:11.000Z", "max_issues_repo_issues_event_max_datetime": "2020-01-01T15:55:14.000Z", "max_forks_repo_path": "test/memoryListTest.js", "max_forks_repo_name": "tcsk/eke-rtt-hw", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 16, "max_forks_count": null, "avg_line_length": 33.5526315789, "max_line_length": 76, "alphanum_fraction": 0.6007843137}
const assert = require('chai').assert;
const expect = require('chai').expect;
const MemoryList = require('../src/collection/MemoryList');
const ComputerPartList = require('../src/collection/ComputerPartList');
const Memory = require('../src/domain/Memory');

describe('MemoryList', function () {

    it('MemoryList should be instantiated', function () {
        let memoryList = new MemoryList();
        assert.instanceOf(memoryList, MemoryList);
    });

    it('MemoryList should be an instance of ComputerPartList', function () {
        let memoryList = new MemoryList();
        assert.instanceOf(memoryList, ComputerPartList);
    });

    it('add should validate processor argument', function () {
        let memoryList = new MemoryList();
        let memory = {};
        expect(() => memoryList.add(memory, 2500)).to.throw(
            'memory is not a valid Memory');
    });

    it('add should validate memory price', function () {
        let memoryList = new MemoryList();
        let memory = new Memory({
            'manufacturer': 'Kingston',
            'model': 'Z693',
            'size': 4096,
            'speed': 2300
        });
        expect(() => memoryList.add(memory, 'abc')).to.throw(
            'Price is not a valid number');
    });
});
