This file contains hidden or 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
describe("Saving the user profile", () => { | |
let profileModule; | |
beforeEach(() => { | |
jasmine.Ajax.install(); | |
profileModule = new ProfileModule(); | |
}); | |
afterEach(() => { | |
jasmine.Ajax.uninstall(); |
This file contains hidden or 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
describe("Saving the user profile", () => { | |
let profileModule; | |
let notifyUserSpy; | |
let onCompleteSpy; | |
beforeEach(() => { | |
profileModule = new ProfileModule(); | |
notifyUserSpy = spyOn(profileModule, "notifyUser"); | |
onCompleteSpy = jasmine.createSpy(); | |
}); |
This file contains hidden or 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
it("should multiply the number passed as parameter and subtract one", () => { | |
const result = Calculator.compute(21.5); | |
expect(result).toBe(42); | |
}); |
This file contains hidden or 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
it("should multiply the number passed as parameter and subtract one", () => { | |
const multiplySpy = spyOn(Calculator, "multiple").and.callThrough(); | |
const subtractSpy = spyOn(Calculator, "subtract").and.callThrough(); | |
const result = Calculator.compute(21.5); | |
expect(multiplySpy).toHaveBeenCalledWith(21.5, 2); | |
expect(subtractSpy).toHaveBeenCalledWith(43, 1); | |
expect(result).toBe(42); | |
}); |
This file contains hidden or 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
it("should properly sanitize strings", () => { | |
let result; | |
const testValues = { | |
Avion: "Avi" + String.fromCharCode(243) + "n", | |
"The-space": "The space", | |
"Weird-chars-": "Weird chars!!", | |
"file-name.zip": "file name.zip", | |
"my-name.zip": "my.name.zip", | |
}; |
This file contains hidden or 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
it("should sanitize a string containing non-ASCII chars", () => { | |
expect(sanitizeString("Avi" + String.fromCharCode(243) + "n")).toBe("Avion"); | |
}); | |
it("should sanitize a string containing spaces", () => { | |
expect(sanitizeString("The space")).toBe("The-space"); | |
}); | |
it("should sanitize a string containing exclamation signs", () => { | |
expect(sanitizeString("Weird chars!!")).toBe("Weird-chars-"); |
This file contains hidden or 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
it("should properly sanitize strings", () => { | |
expect(sanitizeString("Avi" + String.fromCharCode(243) + "n")).toBe("Avion"); | |
expect(sanitizeString("The space")).toBe("The-space"); | |
expect(sanitizeString("Weird chars!!")).toBe("Weird-chars-"); | |
expect(sanitizeString("file name.zip")).toBe("file-name.zip"); | |
expect(sanitizeString("my.name.zip")).toBe("my-name.zip"); | |
}); |
This file contains hidden or 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
it("should properly sanitize strings", () => { | |
let result; | |
const testValues = { | |
Avion: "Avi" + String.fromCharCode(243) + "n", | |
"The-space": "The space", | |
"Weird-chars-": "Weird chars!!", | |
"file-name.zip": "file name.zip", | |
"my-name.zip": "my.name.zip", | |
}; |
This file contains hidden or 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
// Good | |
describe("[unit of work]", () => { | |
it("should [expected behaviour] when [scenario/context]", () => {}); | |
}); | |
// Better | |
describe("[unit of work]", () => { | |
describe("when [scenario/context]", () => { | |
it("should [expected behaviour]", () => {}); | |
}); |
This file contains hidden or 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
describe("The Gallery instance", () => { | |
it("should properly calculate the thumb size when initialized", () => {}); | |
it("should properly calculate the thumbs count when initialized", () => {}); | |
}); |