mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-12-16 04:54:46 +03:00
Fix #812 - Add support for chaining withClientHints() & withFeatureCheck()
This commit is contained in:
@@ -413,4 +413,20 @@ describe('Identify vendor & type of device from given model name', () => {
|
||||
assert.strictEqual(device.type, test.expect.type);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Chaining withClientHints() & withFeatureCheck() in server-side development', () => {
|
||||
const headers = {
|
||||
'user-agent' : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15',
|
||||
'sec-ch-ua-form-factors' : '"VR"'
|
||||
};
|
||||
const device = new UAParser(headers).getDevice();
|
||||
it('Chain order: withFeatureCheck().withClientHints()', () => {
|
||||
const fc2ch = device.withFeatureCheck().withClientHints();
|
||||
assert.strictEqual(fc2ch.type, "xr");
|
||||
});
|
||||
it('Chain order: withClientHints().withFeatureCheck()', () => {
|
||||
const ch2fc = device.withClientHints().withFeatureCheck();
|
||||
assert.strictEqual(ch2fc.type, "xr");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user