-
Notifications
You must be signed in to change notification settings - Fork 85
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 #6972 from Sage/FE-6790
refactor: convert utils & validations from enzyme to RTL
- Loading branch information
Showing
15 changed files
with
686 additions
and
696 deletions.
There are no files selected for viewing
31 changes: 0 additions & 31 deletions
31
src/__internal__/utils/helpers/browser-type-check/browser-type-check.spec.ts
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
src/__internal__/utils/helpers/browser-type-check/browser-type-check.test.ts
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,37 @@ | ||
import browserCheck, { isSafari } from "."; | ||
|
||
describe("browserTypeCheck", () => { | ||
test('returns true when the "chrome" property is present in the browser object', () => { | ||
const browser = { chrome: { foo: true }, sidebar: undefined }; | ||
const result = browserCheck(browser); | ||
expect(result).toEqual(true); | ||
}); | ||
test('returns true when the "sidebar" property is present in the browser object', () => { | ||
const browser = { chrome: undefined, sidebar: { foo: true } }; | ||
const result = browserCheck(browser); | ||
expect(result).toEqual(true); | ||
}); | ||
test('returns true when the "chrome" and "sidebar" properties are present in the browser object', () => { | ||
const browser = { chrome: { foo: true }, sidebar: { foo: true } }; | ||
const result = browserCheck(browser); | ||
expect(result).toEqual(true); | ||
}); | ||
test('returns false when the "chrome" and "sidebar" properties are not present in the browser object', () => { | ||
const browser = {}; | ||
const result = browserCheck(browser); | ||
expect(result).toEqual(false); | ||
}); | ||
}); | ||
|
||
describe("isSafari", () => { | ||
test('returns true when the vendor string contains "Apple"', () => { | ||
const navigator = { vendor: "Apple" } as Navigator; | ||
const result = isSafari(navigator); | ||
expect(result).toEqual(true); | ||
}); | ||
test('returns false when the vendor string does not contain "Apple"', () => { | ||
const navigator = { vendor: "foo" } as Navigator; | ||
const result = isSafari(navigator); | ||
expect(result).toEqual(false); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.