Upgrade Storybook
Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
parent
8c966dfbd8
commit
502ea174ab
328 changed files with 10863 additions and 12432 deletions
|
@ -7,15 +7,15 @@ import * as sinon from 'sinon';
|
|||
import { getUserAgent } from '../../util/getUserAgent';
|
||||
|
||||
describe('getUserAgent', () => {
|
||||
beforeEach(function beforeEach() {
|
||||
beforeEach(function (this: Mocha.Context) {
|
||||
this.sandbox = sinon.createSandbox();
|
||||
});
|
||||
|
||||
afterEach(function afterEach() {
|
||||
afterEach(function (this: Mocha.Context) {
|
||||
this.sandbox.restore();
|
||||
});
|
||||
|
||||
it('returns the right User-Agent on Windows', function test() {
|
||||
it('returns the right User-Agent on Windows', function (this: Mocha.Context) {
|
||||
this.sandbox.stub(process, 'platform').get(() => 'win32');
|
||||
assert.strictEqual(
|
||||
getUserAgent('1.2.3', '10.0.22000'),
|
||||
|
@ -23,7 +23,7 @@ describe('getUserAgent', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('returns the right User-Agent on macOS', function test() {
|
||||
it('returns the right User-Agent on macOS', function (this: Mocha.Context) {
|
||||
this.sandbox.stub(process, 'platform').get(() => 'darwin');
|
||||
assert.strictEqual(
|
||||
getUserAgent('1.2.3', '21.5.0'),
|
||||
|
@ -31,7 +31,7 @@ describe('getUserAgent', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('returns the right User-Agent on Linux', function test() {
|
||||
it('returns the right User-Agent on Linux', function (this: Mocha.Context) {
|
||||
this.sandbox.stub(process, 'platform').get(() => 'linux');
|
||||
assert.strictEqual(
|
||||
getUserAgent('1.2.3', '20.04'),
|
||||
|
@ -39,7 +39,7 @@ describe('getUserAgent', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('omits the platform on unsupported platforms', function test() {
|
||||
it('omits the platform on unsupported platforms', function (this: Mocha.Context) {
|
||||
this.sandbox.stub(process, 'platform').get(() => 'freebsd');
|
||||
assert.strictEqual(getUserAgent('1.2.3', '13.1'), 'Signal-Desktop/1.2.3');
|
||||
});
|
||||
|
|
|
@ -7,17 +7,16 @@ import { useFakeTimers } from 'sinon';
|
|||
import { sleep } from '../../util/sleep';
|
||||
|
||||
describe('sleep', () => {
|
||||
beforeEach(function beforeEach() {
|
||||
beforeEach(function (this: Mocha.Context) {
|
||||
// This isn't a hook.
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
this.clock = useFakeTimers();
|
||||
});
|
||||
|
||||
afterEach(function afterEach() {
|
||||
afterEach(function (this: Mocha.Context) {
|
||||
this.clock.restore();
|
||||
});
|
||||
|
||||
it('returns a promise that resolves after the specified number of milliseconds', async function test() {
|
||||
it('returns a promise that resolves after the specified number of milliseconds', async function (this: Mocha.Context) {
|
||||
let isDone = false;
|
||||
|
||||
void (async () => {
|
||||
|
|
|
@ -11,25 +11,25 @@ import * as Sinon from 'sinon';
|
|||
import { writeWindowsZoneIdentifier } from '../../util/windowsZoneIdentifier';
|
||||
|
||||
describe('writeWindowsZoneIdentifier', () => {
|
||||
before(function thisNeeded() {
|
||||
before(function (this: Mocha.Context) {
|
||||
if (process.platform !== 'win32') {
|
||||
this.skip();
|
||||
}
|
||||
});
|
||||
|
||||
beforeEach(async function thisNeeded() {
|
||||
beforeEach(async function (this: Mocha.Context) {
|
||||
this.sandbox = Sinon.createSandbox();
|
||||
this.tmpdir = await fs.promises.mkdtemp(
|
||||
path.join(os.tmpdir(), 'signal-test-')
|
||||
);
|
||||
});
|
||||
|
||||
afterEach(async function thisNeeded() {
|
||||
afterEach(async function (this: Mocha.Context) {
|
||||
this.sandbox.restore();
|
||||
await fse.remove(this.tmpdir);
|
||||
});
|
||||
|
||||
it('writes zone transfer ID 3 (internet) to the Zone.Identifier file', async function thisNeeded() {
|
||||
it('writes zone transfer ID 3 (internet) to the Zone.Identifier file', async function (this: Mocha.Context) {
|
||||
const file = path.join(this.tmpdir, 'file.txt');
|
||||
await fse.outputFile(file, 'hello');
|
||||
|
||||
|
@ -41,7 +41,7 @@ describe('writeWindowsZoneIdentifier', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('fails if there is an existing Zone.Identifier file', async function thisNeeded() {
|
||||
it('fails if there is an existing Zone.Identifier file', async function (this: Mocha.Context) {
|
||||
const file = path.join(this.tmpdir, 'file.txt');
|
||||
await fse.outputFile(file, 'hello');
|
||||
await fs.promises.writeFile(`${file}:Zone.Identifier`, '# already here');
|
||||
|
@ -49,13 +49,13 @@ describe('writeWindowsZoneIdentifier', () => {
|
|||
await assert.isRejected(writeWindowsZoneIdentifier(file));
|
||||
});
|
||||
|
||||
it('fails if the original file does not exist', async function thisNeeded() {
|
||||
it('fails if the original file does not exist', async function (this: Mocha.Context) {
|
||||
const file = path.join(this.tmpdir, 'file-never-created.txt');
|
||||
|
||||
await assert.isRejected(writeWindowsZoneIdentifier(file));
|
||||
});
|
||||
|
||||
it('fails if not on Windows', async function thisNeeded() {
|
||||
it('fails if not on Windows', async function (this: Mocha.Context) {
|
||||
this.sandbox.stub(process, 'platform').get(() => 'darwin');
|
||||
|
||||
const file = path.join(this.tmpdir, 'file.txt');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue