Esempio n. 1
0
	it('should not identify the state from a history with non existing items', function(done) {
        var shortHistory = new BusHistory(['A','X','B']);
        var state = BusHistoryUtils.identifyStateFromHistory(shortHistory, streets);
        Assert.deepStrictEqual(state, 0, "Should not be able to identify state");
        done();
	});
Esempio n. 2
0
	it('should identify the state as returning with a match skipping one entry', function(done) {
        var shortHistory = new BusHistory(['F','A']); // the perfect sequence would be FEA
        var state = BusHistoryUtils.identifyStateFromHistory(shortHistory, streets);
        Assert.deepStrictEqual(state, -1, "Should be able to identify state as returning");
        done();
	});
Esempio n. 3
0
	it('should preserve the timeline object when trying to identify the state', function(done) {
        var shortHistory = new BusHistory(['A','X','B']);
        BusHistoryUtils.identifyStateFromHistory(shortHistory, streets);
        Assert.deepStrictEqual(shortHistory.timeline.length, 3, "Should have preserved the timeline list");
        done();
	});
Esempio n. 4
0
	it('should identify the state as returning with a perfect match', function(done) {
        var shortHistory = new BusHistory(['E','F']);
        var state = BusHistoryUtils.identifyStateFromHistory(shortHistory, streets);
        Assert.deepStrictEqual(state, -1, "Should be able to identify state as returning");
        done();
	});