-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed case where slow tests would fail due to fixture changing over time
- Loading branch information
Showing
3 changed files
with
9 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,12 @@ import * as moment from "moment"; | |
import {IJwtToken, IUser} from "./ngJwtAuthInterfaces"; | ||
|
||
let seededChance:Chance.Chance = new Chance(1); | ||
|
||
let loadedToken:string; | ||
|
||
export const fixtures = { | ||
loginPrompt:null, | ||
user: { | ||
_self: '/users/1', | ||
userId: 1, | ||
email: '[email protected]', | ||
firstName: seededChance.first(), | ||
|
@@ -50,8 +53,10 @@ export const fixtures = { | |
}, | ||
|
||
get token(){ | ||
|
||
return fixtures.buildToken(); //no customisations | ||
if (!loadedToken){ | ||
loadedToken = fixtures.buildToken(); //no customisations | ||
} | ||
return loadedToken; //this "caching" ensures the token is unchanged between tests if they take too long (otherwise the timestamps may differ) | ||
} | ||
}; | ||
|
||
|
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