-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #352 from RickCarlino/master
Yarnfile Updates
- Loading branch information
Showing
8 changed files
with
64 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import * as React from "react"; | ||
import { mount } from "enzyme"; | ||
import { PasswordReset } from "../password_reset"; | ||
import * as moxios from "moxios"; | ||
import { API } from "../../api/api"; | ||
import { State } from "../interfaces"; | ||
|
||
describe("<PasswordReset/>", () => { | ||
beforeEach(function () { | ||
// import and pass your custom axios instance to this method | ||
moxios.install(); | ||
}); | ||
|
||
afterEach(function () { | ||
// import and pass your custom axios instance to this method | ||
moxios.uninstall(); | ||
}); | ||
|
||
fit("resets the users password", (done) => { | ||
expect.assertions(5); | ||
let el = mount(<PasswordReset />); | ||
el.setState({ | ||
password: "knocknock", | ||
passwordConfirmation: "knocknock", | ||
serverURL: "localhost", | ||
serverPort: "3000" | ||
}); | ||
el.find("form").simulate("submit", { preventDefault: jest.fn() }); | ||
moxios.wait(function () { | ||
let request = moxios.requests.mostRecent(); | ||
request.respondWith({ | ||
status: 200, | ||
response: {} | ||
}).then(function (resp) { | ||
expect(resp.config.url).toContain("api/password_resets"); | ||
expect(resp.config.method).toEqual("put"); | ||
let json: State = JSON.parse(resp.config.data); | ||
expect(Object.keys(json)).toContain("password"); | ||
expect(Object.keys(json)).toContain("password_confirmation"); | ||
expect(json.password).toEqual("knocknock"); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ export interface State { | |
serverPort?: string; | ||
} | ||
|
||
export interface Props { }; | ||
export interface Props { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters