Upgrade to ExtJS 3.2.2 - Released 06/02/2010
[extjs.git] / test / unit / util / JSON.js
1 /*!
2  * Ext JS Library 3.2.2
3  * Copyright(c) 2006-2010 Ext JS, Inc.
4  * licensing@extjs.com
5  * http://www.extjs.com/license
6  */
7 Ext.test.session.addTest( 'Ext.util', {
8
9     name: 'JSON',
10
11     planned: 4,
12
13     // same as Ext.encode
14     // 1
15     test_encode: function() {
16         Y.Assert.areEqual( '{"foo":"bar"}', Ext.util.JSON.encode( { foo: 'bar' } ), 'Test encode with simple object' );
17     },
18
19     // same as Ext.decode
20     // 2
21     test_decode: function() {
22         Y.ObjectAssert.hasKeys({
23             foo: 'bar'
24         }, Ext.util.JSON.decode( '{"foo":"bar"}' ), 'Test decode with a simple object');
25         Y.ObjectAssert.hasKeys({
26             foo: ['bar','baz']
27         }, Ext.util.JSON.decode( '{"foo":["bar","baz"]}' ), 'Test decode with a hash + array');
28     }
29
30     // encodeDate
31
32 });