Skip to content

Commit

Permalink
Merge pull request #3 from carls-app/fix-promises
Browse files Browse the repository at this point in the history
Re-enable es6-promise for the Treo internals
  • Loading branch information
hawkrives committed Jul 19, 2018
2 parents a0a92e4 + f8fd5f3 commit f8668e9
Show file tree
Hide file tree
Showing 27 changed files with 278 additions and 425 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,16 @@ Array [
"credits",
],
"credits": 1,
"department": Array [
"CHEM",
"BIO",
],
"number": 111,
"number": "111",
"subject": "CHEM",
},
Object {
"_extraKeys": Array [
"credits",
],
"credits": 1,
"department": Array [
"CHEM",
"BIO",
],
"number": 112,
"number": "112",
"subject": "BIO",
},
]
`;
Expand All @@ -34,22 +28,16 @@ Array [
"credits",
],
"credits": 1,
"department": Array [
"CHEM",
"BIO",
],
"number": 111,
"number": "111",
"subject": "CHEM",
},
Object {
"_extraKeys": Array [
"credits",
],
"credits": 1,
"department": Array [
"CHEM",
"BIO",
],
"number": 112,
"number": "112",
"subject": "BIO",
},
]
`;
Expand Down Expand Up @@ -264,32 +252,24 @@ Array [
"credits",
],
"credits": 1,
"department": Array [
"CHEM",
"BIO",
],
"number": 111,
"number": "111",
"subject": "CHEM",
},
Object {
"_extraKeys": Array [
"credits",
],
"credits": 1,
"department": Array [
"CHEM",
"BIO",
],
"number": 112,
"number": "112",
"subject": "BIO",
},
Object {
"_extraKeys": Array [
"credits",
],
"credits": 1,
"department": Array [
"CSCI",
],
"number": 251,
"number": "251",
"subject": "CSCI",
},
]
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ describe('compareCourseToCourse', () => {
it('compares select keys of courses', () => {
expect(
compareCourseToCourse(
{department: ['ART'], number: 310},
{department: ['ART'], number: 310},
{subject: 'ART', number: '310'},
{subject: 'ART', number: '310'},
),
).toBe(true)
})
Expand All @@ -18,13 +18,13 @@ describe('compareCourseToCourse', () => {
it('the same department is equal to itself', () => {
expect(
compareCourseToCourse(
{department: ['ART']},
{department: ['ART']},
{subject: 'ART'},
{subject: 'ART'},
),
).toBe(true)
})

it('multiple departments are not the same as a single department', () => {
xit('multiple departments are not the same as a single department', () => {
expect(
compareCourseToCourse(
{department: ['ART']},
Expand All @@ -36,13 +36,13 @@ describe('compareCourseToCourse', () => {
it('different departments are not equal', () => {
expect(
compareCourseToCourse(
{department: ['ASIAN']},
{department: ['ART']},
{subject: 'ASIAN'},
{subject: 'ART'},
),
).toBe(false)
})

it('order is significant', () => {
xit('order is significant', () => {
expect(
compareCourseToCourse(
{department: ['CHEM', 'BIO']},
Expand All @@ -54,19 +54,19 @@ describe('compareCourseToCourse', () => {

describe('compares the "semester" prop', () => {
it('and the same semester is equal to itself', () => {
expect(compareCourseToCourse({semester: 1}, {semester: 1})).toBe(
expect(compareCourseToCourse({semester: 'FA'}, {semester: 'FA'})).toBe(
true,
)
})

it('and different semesters are not equal', () => {
expect(compareCourseToCourse({semester: 2}, {semester: 1})).toBe(
expect(compareCourseToCourse({semester: 'SP'}, {semester: 'FA'})).toBe(
false,
)
})

it('and supports the wildcard selector', () => {
expect(compareCourseToCourse({semester: '*'}, {semester: 1})).toBe(
expect(compareCourseToCourse({semester: '*'}, {semester: 'FA'})).toBe(
true,
)
})
Expand All @@ -90,7 +90,7 @@ describe('compareCourseToCourse', () => {

describe('compares the "number" prop', () => {
it('the same number is equal to itself', () => {
expect(compareCourseToCourse({number: 201}, {number: 201})).toBe(
expect(compareCourseToCourse({number: '201'}, {number: '201'})).toBe(
true,
)
})
Expand All @@ -115,7 +115,7 @@ describe('compareCourseToCourse', () => {
})
})

describe('compares the "level" prop', () => {
xdescribe('compares the "level" prop', () => {
it('the same level is equal to itself', () => {
expect(compareCourseToCourse({level: 100}, {level: 100})).toBe(true)
})
Expand All @@ -126,7 +126,7 @@ describe('compareCourseToCourse', () => {
})
})

describe('compares the "international" prop', () => {
xdescribe('compares the "international" prop', () => {
it('the same "international" value is equal', () => {
expect(
compareCourseToCourse(
Expand All @@ -145,7 +145,7 @@ describe('compareCourseToCourse', () => {
})
})

describe('compares the "type" prop', () => {
xdescribe('compares the "type" prop', () => {
it('the same "type" value is equal', () => {
expect(compareCourseToCourse({type: 'Lab'}, {type: 'Lab'})).toBe(
true,
Expand Down Expand Up @@ -181,17 +181,17 @@ describe('compareCourseToCourse', () => {
it('returns false if the query is more specific than the possibility', () => {
expect(
compareCourseToCourse(
{department: ['ASIAN'], number: 310, section: 'A'},
{department: ['ASIAN'], number: 310},
{subject: 'ASIAN', number: '310', section: 'A'},
{subject: 'ASIAN', number: '310'},
),
).toBe(false)
})

it('returns true if the query is less specific than the possibility', () => {
expect(
compareCourseToCourse(
{department: ['ASIAN'], number: 310},
{department: ['ASIAN'], number: 310, section: 'A'},
{subject: 'ASIAN', number: '310'},
{subject: 'ASIAN', number: '310', section: 'A'},
),
).toBe(true)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,15 +362,15 @@ describe('computeModifier', () => {
{
$type: 'course',
$course: {
department: ['CHEM', 'BIO'],
number: 111,
subject: 'CHEM',
number: '111',
},
},
{
$type: 'course',
$course: {
department: ['CHEM', 'BIO'],
number: 112,
subject: 'BIO',
number: '112',
},
},
],
Expand All @@ -380,17 +380,17 @@ describe('computeModifier', () => {
$type: 'requirement',
result: {
$type: 'course',
$course: {department: ['CSCI'], number: 251},
$course: {subject: 'CSCI', number: '251'},
},
},
result: modifier,
}

const dirty = new Set()
const courses = [
{department: ['CHEM', 'BIO'], number: 111, credits: 1.0},
{department: ['CHEM', 'BIO'], number: 112, credits: 1.0},
{department: ['CSCI'], number: 251, credits: 1.0},
{subject: 'CHEM', number: '111', credits: 1.0},
{subject: 'BIO', number: '112', credits: 1.0},
{subject: 'CSCI', number: '251', credits: 1.0},
]

req.CHBI.computed = computeChunk({
Expand Down Expand Up @@ -520,23 +520,23 @@ describe('computeModifier', () => {
$type: 'requirement',
result: {
$type: 'course',
$course: {department: ['CHEM', 'BIO'], number: 111},
$course: {subject: 'CHEM', number: '111'},
},
},
B: {
$type: 'requirement',
result: {
$type: 'course',
$course: {department: ['CHEM', 'BIO'], number: 112},
$course: {subject: 'BIO', number: '112'},
},
},
result: modifier,
}

const dirty = new Set()
const courses = [
{department: ['CHEM', 'BIO'], number: 111, credits: 1.0},
{department: ['CHEM', 'BIO'], number: 112, credits: 1.0},
{subject: 'CHEM', number: '111', credits: 1.0},
{subject: 'BIO', number: '112', credits: 1.0},
]

req.A.computed = computeChunk({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import countDepartments from '../count-departments'
describe('countDepartments', () => {
it('counts the number of distinct departments in an array of courses', () => {
const courses = [
{department: ['ART']},
{department: ['ART', 'ASIAN']},
{department: ['CHEM', 'BIO']},
{subject: 'ART'},
{subject: 'ART'},
{subject: 'ASIAN'},
{subject: 'CHEM'},
{subject: 'BIO'},
]
expect(countDepartments(courses)).toBe(4)
})
Expand Down
Loading

0 comments on commit f8668e9

Please sign in to comment.