-
Notifications
You must be signed in to change notification settings - Fork 16
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 #74 from baoduy/develop
Improvement
- Loading branch information
Showing
6 changed files
with
75 additions
and
49 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
Submodule jest
updated
from 9b59a4 to 5195b1
Submodule sm-react-service-fabric
updated
from 743d4d to 06d016
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 |
---|---|---|
@@ -1,36 +1,37 @@ | ||
import { getImgSrc, newGuid } from "../../src/commons/commonFuncs"; | ||
import { getImgSrc, newGuid } from '../../src/commons/commonFuncs'; | ||
|
||
test("2 GUID must be difference", () => { | ||
window.sessionStorage.setItem('BASE_URL', '/ReactJs'); | ||
|
||
test('2 GUID must be difference', () => { | ||
const g1 = newGuid(); | ||
const g2 = newGuid(); | ||
|
||
expect(g1).not.toBe(g2); | ||
}); | ||
|
||
test("getImgSrc should add basename to url", () => { | ||
window._base = "/ReactJs"; | ||
expect(getImgSrc("/img/a.png")).toContain(window._base); | ||
test('getImgSrc should add basename to url', () => { | ||
expect(getImgSrc('/img/a.png')).toContain('/ReactJs'); | ||
}); | ||
|
||
test("getImgSrc should not add basename to url", () => { | ||
window._base = "/ReactJs"; | ||
expect(getImgSrc("/ReactJs/img/a.png")).toBe("/ReactJs/img/a.png"); | ||
test('getImgSrc should not add basename to url', () => { | ||
expect(getImgSrc('/ReactJs/img/a.png')).toBe('/ReactJs/img/a.png'); | ||
}); | ||
|
||
test("getImgSrc should return original object", () => { | ||
window._base = "/ReactJs"; | ||
test('getImgSrc should return original object', () => { | ||
const url = { a: 1 }; | ||
expect(getImgSrc(url)).toBe(url); | ||
}); | ||
|
||
test("getImgSrc should return original string", () => { | ||
window._base = "/"; | ||
const url = "123"; | ||
test('getImgSrc should return original string', () => { | ||
const url = '123'; | ||
window.sessionStorage.setItem('BASE_URL', '/'); | ||
|
||
expect(getImgSrc(url)).toBe(url); | ||
}); | ||
|
||
test("getImgSrc should do nothing", () => { | ||
window._base = undefined; | ||
const url = "123"; | ||
test('getImgSrc should do nothing', () => { | ||
const url = '123'; | ||
window.sessionStorage.setItem('BASE_URL', ''); | ||
|
||
expect(getImgSrc(url)).toBe(url); | ||
}); |