angular-cn/modules/angular2/test/http/base_request_options_spec.ts
Jeff Cross 38a5a2a955 chore: move core modules into core directory
BREAKING CHANGE:
    This change moves the http module into angular2/, so its import
    path is now angular2/http instead of http/http.

    Many other modules have also been moved around inside of angular2,
    but the public API paths have not changed as of this commit.
2015-08-25 15:33:22 -07:00

33 lines
1.1 KiB
TypeScript

import {
AsyncTestCompleter,
beforeEach,
ddescribe,
describe,
expect,
iit,
inject,
it,
xit
} from 'angular2/test_lib';
import {BaseRequestOptions, RequestOptions} from 'http/src/base_request_options';
import {RequestMethods, RequestModesOpts} from 'http/src/enums';
export function main() {
describe('BaseRequestOptions', () => {
it('should create a new object when calling merge', () => {
var options1 = new BaseRequestOptions();
var options2 = options1.merge(new RequestOptions({method: RequestMethods.DELETE}));
expect(options2).not.toBe(options1);
expect(options2.method).toBe(RequestMethods.DELETE);
});
it('should retain previously merged values when merging again', () => {
var options1 = new BaseRequestOptions();
var options2 = options1.merge(new RequestOptions({method: RequestMethods.DELETE}));
var options3 = options2.merge(new RequestOptions({mode: RequestModesOpts.NoCors}));
expect(options3.mode).toBe(RequestModesOpts.NoCors);
expect(options3.method).toBe(RequestMethods.DELETE);
});
});
}