Skip to content

Commit

Permalink
Fix getmac test (#48804)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrmarti committed May 28, 2018
1 parent 8a1f33d commit 3e06a9d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/vs/base/test/node/id.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@
'use strict';

import * as assert from 'assert';
import * as getmac from 'getmac';
import { getMachineId } from 'vs/base/node/id';

suite('ID', () => {

test('getMachineId', function () {
return getMachineId().then(id => {
assert.ok(/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/.test(id), `Expected a MAC address: ${id}`);
assert.ok(id);
});
});

test('getMac', function () {
return new Promise<string>((resolve, reject) => {
getmac.getMac((err, macAddress) => err ? reject(err) : resolve(macAddress));
}).then(macAddress => {
assert.ok(/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/.test(macAddress), `Expected a MAC address, got: ${macAddress}`);
});
});
});

0 comments on commit 3e06a9d

Please sign in to comment.