2016-10-27 07:01:23 +08:00
|
|
|
Event = require("../../src/flux/models/event").default
|
fix(spec): add support for async specs and disable misbehaving ones
More spec fixes
replace process.nextTick with setTimeout(fn, 0) for specs
Also added an unspy in the afterEach
Temporarily disable specs
fix(spec): start fixing specs
Summary:
This is the WIP fix to our spec runner.
Several tests have been completely commented out that will require
substantially more work to fix. These have been added to our sprint
backlog.
Other tests have been fixed to update to new APIs or to deal with genuine
bugs that were introduced without our knowing!
The most common non-trivial change relates to observing the `NylasAPI` and
`NylasAPIRequest`. We used to observe the arguments to `makeRequest`.
Unfortunately `NylasAPIRequest.run` is argumentless. Instead you can do:
`NylasAPIRequest.prototype.run.mostRecentCall.object.options` to get the
`options` passed into the object. the `.object` property grabs the context
of the spy when it was last called.
Fixing these tests uncovered several concerning issues with our test
runner. I spent a while tracking down why our participant-text-field-spec
was failling every so often. I chose that spec because it was the first
spec to likely fail, thereby requiring looking at the least number of
preceding files. I tried binary searching, turning on and off, several
files beforehand only to realize that the failure rate was not determined
by a particular preceding test, but rather the existing and quantity of
preceding tests, AND the number of console.log statements I had. There is
some processor-dependent race condition going on that needs further
investigation.
I also discovered an issue with the file-download-spec. We were getting
errors about it accessing a file, which was very suspicious given the code
stubs out all fs access. This was caused due to a spec that called an
async function outside ot a `waitsForPromise` block or a `waitsFor` block.
The test completed, the spies were cleaned up, but the downstream async
chain was still running. By the time the async chain finished the runner
was already working on the next spec and the spies had been restored
(causing the real fs access to run).
Juan had an idea to kill the specs once one fails to prevent cascading
failures. I'll implement this in the next diff update
Test Plan: npm test
Reviewers: juan, halla, jackie
Differential Revision: https://phab.nylas.com/D3501
Disable other specs
Disable more broken specs
All specs turned off till passing state
Use async-safe versions of spec functions
Add async test spec
Remove unused package code
Remove canary spec
2016-12-13 04:12:20 +08:00
|
|
|
AccountStore = require("../../src/flux/stores/account-store").default
|
2015-07-29 09:21:30 +08:00
|
|
|
|
|
|
|
json_event =
|
|
|
|
{
|
2017-06-27 14:48:55 +08:00
|
|
|
"__cls": "Event",
|
2015-07-29 09:21:30 +08:00
|
|
|
"id": "4ee4xbnx7pxdb9g7c2f8ncyto",
|
|
|
|
"calendar_id": "ci0k1wfyv533ccgox4t7uri4h",
|
feat(accounts): Kill namespaces, long live accounts
Summary:
This diff replaces the Namespace object with the Account object, and changes all references to namespace_id => account_id, etc. The endpoints are now `/threads` instead of `/n/<id>/threads`.
This diff also adds preliminary support for multiple accounts. When you log in, we now log you in to all the attached accounts on edgehill server. From the preferences panel, you can auth with / unlink additional accounts. Shockingly, this all seems to pretty much work.
When replying to a thread, you cannot switch from addresses. However, when creating a new message in a popout composer, you can change the from address and the SaveDraftTask will delete/re-root the draft on the new account.
Search bar doesn't need to do full refresh on clear if it never committed
Allow drafts to be switched to a different account when not in reply to an existing thread
Fix edge case where ChangeMailTask throws exception if no models are modified during performLocal
Show many dots for many accounts in long polling status bar
add/remove accounts from prefs
Spec fixes!
Test Plan: Run tests, none broken!
Reviewers: evan, dillon
Reviewed By: evan, dillon
Differential Revision: https://phab.nylas.com/D1928
2015-08-22 06:29:58 +08:00
|
|
|
"account_id": "14e5bn96uizyuhidhcw5rfrb0",
|
2015-07-29 09:21:30 +08:00
|
|
|
"description": null,
|
|
|
|
"location": null,
|
|
|
|
"participants": [
|
|
|
|
{
|
|
|
|
"email": "example@gmail.com",
|
|
|
|
"name": "Ben Bitdiddle",
|
|
|
|
"status": "yes"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"read_only": false,
|
|
|
|
"title": "Meeting with Ben Bitdiddle",
|
|
|
|
"when": {
|
|
|
|
"object": "timespan",
|
|
|
|
"end_time": 1408123800,
|
|
|
|
"start_time": 1408120200
|
|
|
|
},
|
|
|
|
"busy": true,
|
|
|
|
"status": "confirmed",
|
|
|
|
}
|
|
|
|
|
|
|
|
when_1 =
|
|
|
|
end_time: 1408123800
|
|
|
|
start_time: 1408120200
|
|
|
|
|
|
|
|
participant_1 =
|
|
|
|
name: "Ethan Blackburn"
|
|
|
|
status: "yes"
|
|
|
|
email: "ethan@nylas.com"
|
|
|
|
|
|
|
|
participant_2 =
|
|
|
|
name: "Other Person"
|
|
|
|
status: "maybe"
|
|
|
|
email: "other@person.com"
|
|
|
|
|
|
|
|
participant_3 =
|
|
|
|
name: "Another Person"
|
|
|
|
status: "no"
|
|
|
|
email: "another@person.com"
|
|
|
|
|
|
|
|
event_1 =
|
|
|
|
title: "Dolores"
|
|
|
|
description: "Hanging at the park"
|
|
|
|
location: "Dolores Park"
|
|
|
|
when: when_1
|
|
|
|
start: 1408120200
|
|
|
|
end: 1408123800
|
|
|
|
participants: [participant_1, participant_2, participant_3]
|
|
|
|
|
|
|
|
describe "Event", ->
|
|
|
|
|
|
|
|
it "can be built via the constructor", ->
|
|
|
|
e1 = new Event event_1
|
|
|
|
expect(e1.title).toBe "Dolores"
|
|
|
|
expect(e1.description).toBe "Hanging at the park"
|
|
|
|
expect(e1.location).toBe "Dolores Park"
|
|
|
|
expect(e1.when.start_time).toBe 1408120200
|
|
|
|
expect(e1.when.end_time).toBe 1408123800
|
|
|
|
expect(e1.start).toBe 1408120200
|
|
|
|
expect(e1.end).toBe 1408123800
|
|
|
|
expect(e1.participants[0].name).toBe "Ethan Blackburn"
|
|
|
|
expect(e1.participants[0].email).toBe "ethan@nylas.com"
|
|
|
|
expect(e1.participants[0].status).toBe "yes"
|
|
|
|
expect(e1.participants[1].name).toBe "Other Person"
|
|
|
|
expect(e1.participants[1].email).toBe "other@person.com"
|
|
|
|
expect(e1.participants[1].status).toBe "maybe"
|
|
|
|
expect(e1.participants[2].name).toBe "Another Person"
|
|
|
|
expect(e1.participants[2].email).toBe "another@person.com"
|
|
|
|
expect(e1.participants[2].status).toBe "no"
|
|
|
|
|
|
|
|
it "accepts a JSON response", ->
|
|
|
|
e1 = (new Event).fromJSON(json_event)
|
|
|
|
expect(e1.title).toBe "Meeting with Ben Bitdiddle"
|
2016-02-06 05:49:18 +08:00
|
|
|
expect(e1.description).toBe null
|
|
|
|
expect(e1.location).toBe null
|
2015-07-29 09:21:30 +08:00
|
|
|
expect(e1.start).toBe 1408120200
|
|
|
|
expect(e1.end).toBe 1408123800
|
|
|
|
expect(e1.participants[0].name).toBe "Ben Bitdiddle"
|
|
|
|
expect(e1.participants[0].email).toBe "example@gmail.com"
|
|
|
|
expect(e1.participants[0].status).toBe "yes"
|