Skip to content

Commit

Permalink
removed not.be.null checks from list-test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
hossenlopp committed Jul 29, 2024
1 parent f0affad commit 3458a44
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions test/elm/list/list-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,49 +673,42 @@ describe('First', () => {
it('should get first of a list of numbers and the localId should exist on the root context', async function () {
(await this.numbers.exec(this.ctx)).should.equal(1);
const listLocalId = getLocalIdByPath(data, 'First', 'Numbers', 'source');
should(listLocalId).not.be.null();
should(this.ctx.localId_context[listLocalId]).not.be.undefined();
});

it('should get first of a list of letters and the localId should exist on the root context', async function () {
(await this.letters.exec(this.ctx)).should.equal('a');
const listLocalId = getLocalIdByPath(data, 'First', 'Letters', 'source');
should(listLocalId).not.be.null();
should(this.ctx.localId_context[listLocalId]).not.be.undefined();
});

it('should get first of a list of lists and the localId should exist on the root context', async function () {
(await this.lists.exec(this.ctx)).should.eql(['a', 'b', 'c']);
const listLocalId = getLocalIdByPath(data, 'First', 'Lists', 'source');
should(listLocalId).not.be.null();
should(this.ctx.localId_context[listLocalId]).not.be.undefined();
});

it('should get first of a list of tuples and the localId should exist on the root context', async function () {
(await this.tuples.exec(this.ctx)).should.eql({ a: 1, b: 2, c: 3 });
const listLocalId = getLocalIdByPath(data, 'First', 'Tuples', 'source');
should(listLocalId).not.be.null();
should(this.ctx.localId_context[listLocalId]).not.be.undefined();
});

it('should get first of a list of unordered numbers and the localId should exist on the root context', async function () {
(await this.unordered.exec(this.ctx)).should.equal(3);
const listLocalId = getLocalIdByPath(data, 'First', 'Unordered', 'source');
should(listLocalId).not.be.null();
should(this.ctx.localId_context[listLocalId]).not.be.undefined();
});

it('should return null for an empty list and the localId should exist on the root context', async function () {
should(await this.empty.exec(this.ctx)).be.null();
const listLocalId = getLocalIdByPath(data, 'First', 'Empty', 'source');
should(listLocalId).not.be.null();
should(this.ctx.localId_context[listLocalId]).not.be.undefined();
});

it('should return null for a null list and the localId should exist on the root context', async function () {
should(await this.nullValue.exec(this.ctx)).be.null();
const asLocalId = getLocalIdByPath(data, 'First', 'NullValue', 'source');
should(asLocalId).not.be.null();
should(this.ctx.localId_context[asLocalId]).not.be.undefined();
});
});
Expand All @@ -728,49 +721,42 @@ describe('Last', () => {
it('should get last of a list of numbers and the localId should exist on the root context', async function () {
(await this.numbers.exec(this.ctx)).should.equal(4);
const listLocalId = getLocalIdByPath(data, 'Last', 'Numbers', 'source');
should(listLocalId).not.be.null();
should(this.ctx.localId_context[listLocalId]).not.be.undefined();
});

it('should get last of a list of letters and the localId should exist on the root context', async function () {
(await this.letters.exec(this.ctx)).should.equal('c');
const listLocalId = getLocalIdByPath(data, 'Last', 'Letters', 'source');
should(listLocalId).not.be.null();
should(this.ctx.localId_context[listLocalId]).not.be.undefined();
});

it('should get last of a list of lists and the localId should exist on the root context', async function () {
(await this.lists.exec(this.ctx)).should.eql(['d', 'e', 'f']);
const listLocalId = getLocalIdByPath(data, 'Last', 'Lists', 'source');
should(listLocalId).not.be.null();
should(this.ctx.localId_context[listLocalId]).not.be.undefined();
});

it('should get last of a list of tuples and the localId should exist on the root context', async function () {
(await this.tuples.exec(this.ctx)).should.eql({ a: 24, b: 25, c: 26 });
const listLocalId = getLocalIdByPath(data, 'Last', 'Tuples', 'source');
should(listLocalId).not.be.null();
should(this.ctx.localId_context[listLocalId]).not.be.undefined();
});

it('should get last of a list of unordered numbers and the localId should exist on the root context', async function () {
(await this.unordered.exec(this.ctx)).should.equal(2);
const listLocalId = getLocalIdByPath(data, 'Last', 'Unordered', 'source');
should(listLocalId).not.be.null();
should(this.ctx.localId_context[listLocalId]).not.be.undefined();
});

it('should return null for an empty list and the localId should exist on the root context', async function () {
should(await this.empty.exec(this.ctx)).be.null();
const listLocalId = getLocalIdByPath(data, 'Last', 'Empty', 'source');
should(listLocalId).not.be.null();
should(this.ctx.localId_context[listLocalId]).not.be.undefined();
});

it('should return null for a null list and the localId should exist on the root context', async function () {
should(await this.nullValue.exec(this.ctx)).be.null();
const asLocalId = getLocalIdByPath(data, 'Last', 'NullValue', 'source');
should(asLocalId).not.be.null();
should(this.ctx.localId_context[asLocalId]).not.be.undefined();
});
});
Expand Down Expand Up @@ -827,27 +813,22 @@ describe('Skip', () => {
it('should skip two elements and the localId of the source and the startIndex should exist on the root context', async function () {
(await this.skip2.exec(this.ctx)).should.eql([3, 4, 5]);
const listLocalId = getLocalIdByPath(data, 'Skip', 'Skip2', 'source');
should(listLocalId).not.be.null();
should(this.ctx.localId_context[listLocalId]).not.be.undefined();
const literalLocalId = getLocalIdByPath(data, 'Skip', 'Skip2', 'startIndex');
should(literalLocalId).not.be.null();
should(this.ctx.localId_context[literalLocalId]).not.be.undefined();
});

it('should not skip when using null and the localId of the source should exist on the root context', async function () {
(await this.skipNull.exec(this.ctx)).should.eql([1, 3, 5]);
const listLocalId = getLocalIdByPath(data, 'Skip', 'SkipNull', 'source');
should(listLocalId).not.be.null();
should(this.ctx.localId_context[listLocalId]).not.be.undefined();
});

it('should return empty list when using negative number and the localId of the source and the startIndex should exist on the root context', async function () {
(await this.skipEmpty.exec(this.ctx)).should.eql([]);
const listLocalId = getLocalIdByPath(data, 'Skip', 'SkipEmpty', 'source');
should(listLocalId).not.be.null();
should(this.ctx.localId_context[listLocalId]).not.be.undefined();
const negateLocalId = getLocalIdByPath(data, 'Skip', 'SkipEmpty', 'startIndex');
should(negateLocalId).not.be.null();
should(this.ctx.localId_context[negateLocalId]).not.be.undefined();
});

Expand All @@ -864,14 +845,12 @@ describe('Tail', () => {
it('should get tail of list and the localId of the source should exist on the root context', async function () {
(await this.tail234.exec(this.ctx)).should.eql([2, 3, 4]);
const listLocalId = getLocalIdByPath(data, 'Tail', 'Tail234', 'source');
should(listLocalId).not.be.null();
should(this.ctx.localId_context[listLocalId]).not.be.undefined();
});

it('should return empty list when given empty list and the localId of the source should exist on the root context', async function () {
(await this.tailEmpty.exec(this.ctx)).should.eql([]);
const listLocalId = getLocalIdByPath(data, 'Tail', 'TailEmpty', 'source');
should(listLocalId).not.be.null();
should(this.ctx.localId_context[listLocalId]).not.be.undefined();
});

Expand All @@ -888,21 +867,18 @@ describe('Take', () => {
it('should take two elements and the localId of the source should exist on the root context', async function () {
(await this.take2.exec(this.ctx)).should.eql([1, 2]);
const listLocalId = getLocalIdByPath(data, 'Take', 'Take2', 'source');
should(listLocalId).not.be.null();
should(this.ctx.localId_context[listLocalId]).not.be.undefined();
});

it('should return full list when asked for too many elements and the localId of the source should exist on the root context', async function () {
(await this.takeTooMany.exec(this.ctx)).should.eql([1, 2]);
const listLocalId = getLocalIdByPath(data, 'Take', 'TakeTooMany', 'source');
should(listLocalId).not.be.null();
should(this.ctx.localId_context[listLocalId]).not.be.undefined();
});

it('should return empty list when using null and the localId of the source should exist on the root context', async function () {
(await this.takeEmpty.exec(this.ctx)).should.eql([]);
const listLocalId = getLocalIdByPath(data, 'Take', 'TakeEmpty', 'source');
should(listLocalId).not.be.null();
should(this.ctx.localId_context[listLocalId]).not.be.undefined();
});

Expand Down

0 comments on commit 3458a44

Please sign in to comment.